Merge pull request #205 from bitshares/fix-websocket-close
Fix race condition in websocket server close
This commit is contained in:
commit
a2b380d58e
1 changed files with 4 additions and 2 deletions
|
|
@ -665,8 +665,9 @@ namespace fc { namespace http {
|
||||||
|
|
||||||
void websocket_server::close()
|
void websocket_server::close()
|
||||||
{
|
{
|
||||||
|
auto cpy_con = my->_connections;
|
||||||
websocketpp::lib::error_code ec;
|
websocketpp::lib::error_code ec;
|
||||||
for( auto& connection : my->_connections )
|
for( auto& connection : cpy_con )
|
||||||
my->_server.close( connection.first, websocketpp::close::status::normal, "Goodbye", ec );
|
my->_server.close( connection.first, websocketpp::close::status::normal, "Goodbye", ec );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -709,8 +710,9 @@ namespace fc { namespace http {
|
||||||
|
|
||||||
void websocket_tls_server::close()
|
void websocket_tls_server::close()
|
||||||
{
|
{
|
||||||
|
auto cpy_con = my->_connections;
|
||||||
websocketpp::lib::error_code ec;
|
websocketpp::lib::error_code ec;
|
||||||
for( auto& connection : my->_connections )
|
for( auto& connection : cpy_con )
|
||||||
my->_server.close( connection.first, websocketpp::close::status::normal, "Goodbye", ec );
|
my->_server.close( connection.first, websocketpp::close::status::normal, "Goodbye", ec );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue