From 9f623551a7eebfa5d9fa6cc2d369d4b3041fc89d Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 18 May 2020 20:27:18 +0200 Subject: [PATCH] Handle clients lost during querying --- unix/x0vncserver/XDesktop.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx index 8be9aa3d..eb36467e 100644 --- a/unix/x0vncserver/XDesktop.cxx +++ b/unix/x0vncserver/XDesktop.cxx @@ -288,9 +288,19 @@ void XDesktop::queryConnection(network::Socket* sock, { assert(isRunning()); + // Someone already querying? if (queryConnectSock) { - server->approveConnection(sock, false, "Another connection is currently being queried."); - return; + std::list sockets; + std::list::iterator i; + + // Check if this socket is still valid + server->getSockets(&sockets); + for (i = sockets.begin(); i != sockets.end(); i++) { + if (*i == queryConnectSock) { + server->approveConnection(sock, false, "Another connection is currently being queried."); + return; + } + } } if (!userName) -- 2.39.5