WebSocketServer: Fix shutdown order

This commit is contained in:
tt2468 2021-04-28 11:40:07 -07:00
parent 5348c80aa8
commit e2d837958f

View File

@ -107,8 +107,6 @@ void WebSocketServer::Stop()
}
lock.unlock();
_server.stop();
_threadPool.waitForDone();
// This can deadlock the thread that it is running on. Bad but kinda required.
@ -116,6 +114,8 @@ void WebSocketServer::Stop()
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
_server.stop();
_serverThread.join();
blog(LOG_INFO, "Server stopped successfully");