FC Updates from BitShares and myself #21
1 changed files with 4 additions and 5 deletions
|
|
@ -207,6 +207,8 @@ namespace fc { namespace http {
|
|||
_server_thread.async( [&](){
|
||||
auto new_con = std::make_shared<websocket_connection_impl<websocket_server_type::connection_ptr>>( _server.get_con_from_hdl(hdl) );
|
||||
_on_connection( _connections[hdl] = new_con );
|
||||
if ( !_closed )
|
||||
_closed = new fc::promise<void>();
|
||||
}).wait();
|
||||
});
|
||||
_server.set_message_handler( [&]( connection_hdl hdl, websocket_server_type::message_ptr msg ){
|
||||
|
|
@ -290,9 +292,6 @@ namespace fc { namespace http {
|
|||
if( _server.is_listening() )
|
||||
_server.stop_listening();
|
||||
|
||||
if( _connections.size() )
|
||||
_closed = new fc::promise<void>();
|
||||
|
||||
auto cpy_con = _connections;
|
||||
for( auto item : cpy_con )
|
||||
_server.close( item.first, 0, "server exit" );
|
||||
|
|
@ -654,8 +653,8 @@ namespace fc { namespace http {
|
|||
void websocket_server::synchronous_close()
|
||||
{
|
||||
close();
|
||||
while (!my->_connections.empty())
|
||||
fc::yield();
|
||||
if (my->_closed)
|
||||
my->_closed->wait();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue