From b8ff2a6f6c957fbc4356aa1084fb6aa5ae585e15 Mon Sep 17 00:00:00 2001 From: Abhay Deshpande Date: Mon, 6 Nov 2023 20:34:55 -0800 Subject: [PATCH] Improve logging when rejecting duplicate connections (#282) --- src/network/websocket/WebSocketServer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/network/websocket/WebSocketServer.cpp b/src/network/websocket/WebSocketServer.cpp index 974db657a..5f3f5bb85 100644 --- a/src/network/websocket/WebSocketServer.cpp +++ b/src/network/websocket/WebSocketServer.cpp @@ -117,10 +117,12 @@ bool SingleClientWSServer::validate(connection_hdl hdl) { if (!entry->second.client.has_value()) { return true; } else { + auto existingConn = server.get_con_from_hdl(entry->second.client.value()); log(LOG_INFO, "Server=%s, Endpoint=%s : Rejected connection from %s - A client is already " - "connected!\n", - serverName.c_str(), path.c_str(), conn->get_remote_endpoint().c_str()); + "connected: %s\n", + serverName.c_str(), path.c_str(), conn->get_remote_endpoint().c_str(), + existingConn->get_remote_endpoint().c_str()); return false; } } else {