|
27 | 27 | #define CCAPI_WEBSOCKET_WRITE_BUFFER_SIZE (1 << 20) |
28 | 28 | #endif |
29 | 29 |
|
| 30 | +#define CCAPI_REQUIRES_INFLATE_STREAM \ |
| 31 | + ((defined(CCAPI_ENABLE_SERVICE_MARKET_DATA) && \ |
| 32 | + (defined(CCAPI_ENABLE_EXCHANGE_HUOBI) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_USDT_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_COIN_SWAP))) || \ |
| 33 | + (defined(CCAPI_ENABLE_SERVICE_EXECUTION_MANAGEMENT) && \ |
| 34 | + (defined(CCAPI_ENABLE_EXCHANGE_HUOBI_USDT_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_COIN_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_BITMART)))) |
| 35 | + |
30 | 36 | #include <regex> |
31 | 37 |
|
32 | 38 | #include "boost/asio/strand.hpp" |
|
50 | 56 | #include "ccapi_cpp/ccapi_fix_connection.h" |
51 | 57 | #include "ccapi_cpp/ccapi_http_connection.h" |
52 | 58 | #include "ccapi_cpp/ccapi_http_retry.h" |
| 59 | +#if CCAPI_REQUIRES_INFLATE_STREAM |
53 | 60 | #include "ccapi_cpp/ccapi_inflate_stream.h" |
| 61 | +#endif |
54 | 62 | #include "ccapi_cpp/ccapi_queue.h" |
55 | 63 | #include "ccapi_cpp/ccapi_request.h" |
56 | 64 | #include "ccapi_cpp/ccapi_session_configs.h" |
@@ -1437,10 +1445,7 @@ class Service : public std::enable_shared_from_this<Service> { |
1437 | 1445 | } else if (stream.got_binary()) { |
1438 | 1446 | CCAPI_LOGGER_DEBUG("received a binary message: " + UtilAlgorithm::stringToHex(std::string(data, dataSize))); |
1439 | 1447 |
|
1440 | | -#if defined(CCAPI_ENABLE_SERVICE_MARKET_DATA) && \ |
1441 | | - (defined(CCAPI_ENABLE_EXCHANGE_HUOBI) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_USDT_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_COIN_SWAP)) || \ |
1442 | | - defined(CCAPI_ENABLE_SERVICE_EXECUTION_MANAGEMENT) && \ |
1443 | | - (defined(CCAPI_ENABLE_EXCHANGE_HUOBI_USDT_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_COIN_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_BITMART)) |
| 1448 | +#if CCAPI_REQUIRES_INFLATE_STREAM |
1444 | 1449 |
|
1445 | 1450 | if (this->needDecompressWebsocketMessage) { |
1446 | 1451 | std::string decompressed; |
@@ -1660,13 +1665,8 @@ class Service : public std::enable_shared_from_this<Service> { |
1660 | 1665 | // std::regex convertNumberToStringInJsonRegex{"(\\[|,|\":)\\s?(-?\\d+\\.?\\d*)"}; |
1661 | 1666 | // std::string convertNumberToStringInJsonRewrite{"$1\"$2\""}; |
1662 | 1667 | bool needDecompressWebsocketMessage{}; |
1663 | | -#if defined(CCAPI_ENABLE_SERVICE_MARKET_DATA) && \ |
1664 | | - (defined(CCAPI_ENABLE_EXCHANGE_HUOBI) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_USDT_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_COIN_SWAP)) || \ |
1665 | | - defined(CCAPI_ENABLE_SERVICE_EXECUTION_MANAGEMENT) && \ |
1666 | | - (defined(CCAPI_ENABLE_EXCHANGE_HUOBI_USDT_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_HUOBI_COIN_SWAP) || defined(CCAPI_ENABLE_EXCHANGE_BITMART)) |
1667 | | - |
| 1668 | +#if CCAPI_REQUIRES_INFLATE_STREAM |
1668 | 1669 | InflateStream inflater; |
1669 | | - |
1670 | 1670 | #endif |
1671 | 1671 |
|
1672 | 1672 | std::array<char, CCAPI_JSON_PARSE_BUFFER_SIZE> jsonParseBuffer; |
|
0 commit comments