From e2d837958fd79939ed3a2b69ca90ecf0da4f8392 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Wed, 28 Apr 2021 11:40:07 -0700 Subject: [PATCH] WebSocketServer: Fix shutdown order --- src/WebSocketServer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WebSocketServer.cpp b/src/WebSocketServer.cpp index 3741a05e..2dc6f106 100644 --- a/src/WebSocketServer.cpp +++ b/src/WebSocketServer.cpp @@ -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");