diff --git a/src/WSServer.cpp b/src/WSServer.cpp index add0e1e1..33639dd1 100644 --- a/src/WSServer.cpp +++ b/src/WSServer.cpp @@ -121,13 +121,11 @@ void WSServer::stop() for (connection_hdl hdl : _connections) { _server.close(hdl, websocketpp::close::status::going_away, "Server stopping"); } - _connections.clear(); - _connectionProperties.clear(); _threadPool.waitForDone(); - while (!_server.stopped()) { - std::this_thread::sleep_for(std::chrono::milliseconds(1)); + while (_connections.size() > 0) { + std::this_thread::sleep_for(std::chrono::milliseconds(10)); } blog(LOG_INFO, "server stopped successfully");