refactor: Use WebsocketClient fn run_in_background in binance gws
This commit is contained in:
1 parent
b4f5e66466
commit
096424b60b
2 files changed
+2
-14
No files matched your search
@@ -135,7 +135,6 @@ struct SpotsGateway::PImpl {
|
||||
GatewayConfig config;
|
||||
std::shared_ptr<bts::config::JetFIX_Connection> jetfix_connection;
|
||||
optional<WebsocketClient> ws_client;
|
||||
optional<thread> ws_run_thread;
|
||||
|
||||
unordered_map<string, Delegate<void(const json &)>> response_handlers;
|
||||
unordered_map<string, CreateOrderMsg> inflight_orders;
|
||||
@@ -193,7 +192,6 @@ struct SpotsGateway::PImpl {
|
||||
|
||||
void start() {
|
||||
INFO_FN("start");
|
||||
bts_assert(!ws_run_thread);
|
||||
LOG(OrderMan, bts::Info, "Creating websocket client. url: {}",
|
||||
config.ws_endpoint);
|
||||
// Init websocket
|
||||
@@ -207,12 +205,7 @@ struct SpotsGateway::PImpl {
|
||||
ws_cli.close_handler().bind<&PImpl::on_close>(*this);
|
||||
INFO_FN("start", "Creating websocket client. url: {}", url);
|
||||
ws_cli.connect();
|
||||
ws_run_thread.emplace([&]() {
|
||||
bts::threading::configure_current_thread("binance_spots_gw_ws");
|
||||
DIAG_FN("binance_spots_exe_ws", "Begin. url: {}", url);
|
||||
ws_cli.run();
|
||||
DIAG_FN("binance_spots_exe_ws", "End. url: {}", url);
|
||||
});
|
||||
ws_cli.run_in_background();
|
||||
}
|
||||
|
||||
void logon() {
|
||||
|
||||
@@ -182,12 +182,7 @@ struct UsdsFuturesGateway::PImpl {
|
||||
ws_cli.close_handler().bind<&PImpl::on_close>(*this);
|
||||
INFO_FN("start", "Creating websocket client. url: {}", url);
|
||||
ws_cli.connect();
|
||||
ws_run_thread.emplace([&]() {
|
||||
configure_current_thread("binance_ufuts_gw_ws");
|
||||
DIAG_FN("binance_ufuts_exe_ws", "Begin. url: {}", url);
|
||||
ws_cli.run();
|
||||
DIAG_FN("binance_ufuts_exe_ws", "End. url: {}", url);
|
||||
});
|
||||
ws_cli.run_in_background();
|
||||
}
|
||||
|
||||
void on_open(const std::error_code &ec) {
|
||||
|
||||
Reference in new issue
Block a user