Fix crash on exit with websocket_client
This commit is contained in:
parent
637f475e44
commit
8012ab4705
1 changed files with 32 additions and 31 deletions
|
|
@ -393,12 +393,12 @@ namespace fc { namespace http {
|
|||
_client.set_message_handler( [&]( connection_hdl hdl, message_ptr msg ){
|
||||
_client_thread.async( [&](){
|
||||
wdump((msg->get_payload()));
|
||||
if( _connection )
|
||||
_connection->on_message( msg->get_payload() );
|
||||
}).wait();
|
||||
});
|
||||
_client.set_close_handler( [=]( connection_hdl hdl ){
|
||||
if( _connection )
|
||||
_client_thread.async( [&](){ if( _connection ) _connection->closed(); _connection.reset(); } ).wait();
|
||||
_client_thread.async( [&](){ if( _connection ) {_connection->closed(); _connection.reset();} } ).wait();
|
||||
if( _closed ) _closed->set_value();
|
||||
});
|
||||
_client.set_fail_handler( [=]( connection_hdl hdl ){
|
||||
|
|
@ -419,6 +419,7 @@ namespace fc { namespace http {
|
|||
if(_connection )
|
||||
{
|
||||
_connection->close(0, "client closed");
|
||||
_connection.reset();
|
||||
_closed->wait();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue