diff options
author | Pierre Ossman <ossman@cendio.se> | 2019-12-09 16:57:04 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2019-12-09 16:57:04 +0100 |
commit | ec3899ecd1c49548b08dd38e1e7a93b4602328a8 (patch) | |
tree | 39e87a8e272ed6cf53839f47e7c4fc286f061c8c /common/rdr/TLSInStream.cxx | |
parent | 86f4f47365f61ccf6104973317af227d6166d7a0 (diff) | |
download | tigervnc-ec3899ecd1c49548b08dd38e1e7a93b4602328a8.tar.gz tigervnc-ec3899ecd1c49548b08dd38e1e7a93b4602328a8.zip |
Handle pending data in TLS buffers
There might be more bytes left in the current TLS record, even if
there is nothing on the underlying stream. Make sure we properly
return this when we aren't being requested to block.
Diffstat (limited to 'common/rdr/TLSInStream.cxx')
-rw-r--r-- | common/rdr/TLSInStream.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/common/rdr/TLSInStream.cxx b/common/rdr/TLSInStream.cxx index 77b16729..8cd07b6c 100644 --- a/common/rdr/TLSInStream.cxx +++ b/common/rdr/TLSInStream.cxx @@ -109,9 +109,11 @@ int TLSInStream::readTLS(U8* buf, int len, bool wait) { int n; - n = in->check(1, 1, wait); - if (n == 0) - return 0; + if (gnutls_record_check_pending(session) == 0) { + n = in->check(1, 1, wait); + if (n == 0) + return 0; + } n = gnutls_record_recv(session, (void *) buf, len); if (n == GNUTLS_E_INTERRUPTED || n == GNUTLS_E_AGAIN) |