From 585089797f7f79a5f521b54e659d1781246e40c1 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 23 Nov 2018 18:03:31 +0100 Subject: [PATCH] Fix connection close log The socket is closed at this point so we have to rely on a cached value for the logging. --- common/rfb/VNCSConnectionST.h | 2 ++ common/rfb/VNCServerST.cxx | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common/rfb/VNCSConnectionST.h b/common/rfb/VNCSConnectionST.h index 7ec2d40b..46a2b28b 100644 --- a/common/rfb/VNCSConnectionST.h +++ b/common/rfb/VNCSConnectionST.h @@ -105,6 +105,8 @@ namespace rfb { updates.add_copied(dest, delta); } + const char* getPeerEndpoint() const {return peerEndpoint.buf;} + private: // SConnection callbacks diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index b3cc7a1f..8a005334 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -177,13 +177,13 @@ void VNCServerST::removeSocket(network::Socket* sock) { if (rfb::Server::maxDisconnectionTime && clients.empty()) disconnectTimer.start(secsToMillis(rfb::Server::maxDisconnectionTime)); + CharArray name(strDup((*ci)->getPeerEndpoint())); + // - Delete the per-Socket resources delete *ci; clients.remove(*ci); - CharArray name; - name.buf = sock->getPeerEndpoint(); connectionsLog.status("closed: %s", name.buf); // - Check that the desktop object is still required -- 2.39.5