From cc5e40f6c99f1181e95c706fc2e7b6383d1419d9 Mon Sep 17 00:00:00 2001 From: Jason Moey Date: Thu, 30 Sep 2021 12:40:35 +0100 Subject: [PATCH] Fixed potential bug in websocket_server.cc: WSInternalHandlerConfig::CreateHandlerRuntime * The logic for WSInternalHandlerConfig::CreateHandlerRuntime should be SINGLE_INSTANCE and not MULTIPLE_INSTANCE to match to the intent of the if-block. * Also removed a semicolon in WSInternalHandlerConfig::OnDisconnect. --- src/websocket_server.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/websocket_server.cc b/src/websocket_server.cc index 4ca4efe..49fb8b0 100644 --- a/src/websocket_server.cc +++ b/src/websocket_server.cc @@ -351,7 +351,7 @@ void LibWebSocketServer::Close(int sockid, int reason_code, /////////////////////////////////////////////////////////////////////////////// bool WSInternalHandlerConfig::CreateHandlerRuntime(const int sockid, struct lws *wsi) { - if (handler_type_ == MULTIPLE_INSTANCE) { + if (handler_type_ == SINGLE_INSTANCE) { if (handler_runtime_.size() != 0) { return false; } @@ -395,7 +395,7 @@ void WSInternalHandlerConfig::OnDisconnect(const int sockid) { handler_->OnDisconnect(sockid); handler_runtime_.erase(iter); return; - }; + } } }