diff options
author | Pierre Ossman <ossman@cendio.se> | 2018-11-23 18:17:53 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2020-05-21 11:34:22 +0200 |
commit | d6bd230991495ad3bf97c2be764fbc034df51d9a (patch) | |
tree | 76a024b3110fc2448909786efc7a10dedeae1800 /common/rfb/SConnection.cxx | |
parent | f4fdc13f37f7ae67b2ba110c24366f84e1e70734 (diff) | |
download | tigervnc-d6bd230991495ad3bf97c2be764fbc034df51d9a.tar.gz tigervnc-d6bd230991495ad3bf97c2be764fbc034df51d9a.zip |
Make sure TLS is allowed to terminate gracefully
Some systems (like TLS) need to send some final data before closing
a connection. Make sure this is properly handled by cleaning up the
security object before closing the underlying network socket.
Diffstat (limited to 'common/rfb/SConnection.cxx')
-rw-r--r-- | common/rfb/SConnection.cxx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index 9e6d0322..b5a69d4c 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -66,13 +66,7 @@ SConnection::SConnection() SConnection::~SConnection() { - if (ssecurity) - delete ssecurity; - delete reader_; - reader_ = 0; - delete writer_; - writer_ = 0; - strFree(clientClipboard); + cleanup(); } void SConnection::setStreams(rdr::InStream* is_, rdr::OutStream* os_) @@ -464,6 +458,7 @@ void SConnection::clientInit(bool shared) void SConnection::close(const char* reason) { state_ = RFBSTATE_CLOSING; + cleanup(); } void SConnection::setPixelFormat(const PixelFormat& pf) @@ -552,6 +547,18 @@ void SConnection::sendClipboardData(const char* data) } } +void SConnection::cleanup() +{ + delete ssecurity; + ssecurity = NULL; + delete reader_; + reader_ = NULL; + delete writer_; + writer_ = NULL; + strFree(clientClipboard); + clientClipboard = NULL; +} + void SConnection::writeFakeColourMap(void) { int i; |