Skip to content

Commit 06aeb8e

Browse files
dejanivBillyONeal
authored andcommitted
Fix issue #1171: Order of object destruction (#1175)
- Connection object is now destroyed before client object - Client is destroyed only when wspp_callback_client is destroyed to prevent race condition with the destructor
1 parent 5b32e16 commit 06aeb8e

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Release/src/websockets/client/ws_client_wspp.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,6 @@ class wspp_callback_client : public websocket_client_callback_impl,
689689
}
690690
} // unlock
691691

692-
// Delete client to make sure Websocketpp cleans up all Boost.Asio portions.
693-
m_client.reset();
694-
695692
if (connecting)
696693
{
697694
websocket_exception exc(ec, build_error_msg(ec, "set_fail_handler"));
@@ -801,15 +798,14 @@ class wspp_callback_client : public websocket_client_callback_impl,
801798
websocketpp::client<websocketpp::config::asio_tls_client> m_client;
802799
};
803800

804-
websocketpp::connection_hdl m_con;
805-
806801
pplx::task_completion_event<void> m_connect_tce;
807802
pplx::task_completion_event<void> m_close_tce;
808803

809804
// Used to safe guard the wspp client.
810805
std::mutex m_wspp_client_lock;
811806
State m_state;
812807
std::unique_ptr<websocketpp_client_base> m_client;
808+
websocketpp::connection_hdl m_con;
813809

814810
// Queue to track pending sends
815811
outgoing_msg_queue m_out_queue;

0 commit comments

Comments
 (0)