aboutsummaryrefslogtreecommitdiffstats
path: root/common/rdr/TLSInStream.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2021-06-10 16:32:29 +0200
committerPierre Ossman <ossman@cendio.se>2021-06-11 09:42:44 +0200
commitd1ad6b5c250d0bc4c43b4d9983badf8ce01b5747 (patch)
treec0a0422c393671b81b537af146b6720b54618a5d /common/rdr/TLSInStream.cxx
parentaa224673e44ba1346884b48e621dd1c8987c6828 (diff)
downloadtigervnc-d1ad6b5c250d0bc4c43b4d9983badf8ce01b5747.tar.gz
tigervnc-d1ad6b5c250d0bc4c43b4d9983badf8ce01b5747.zip
Remove early data check for TLSInStream
Having this early check means that we somewhat randomly get different exception behaviours on errors in deeper layers as some exceptions are allowed to propagate unhindered and some are not (since they are thrown in the pull function).
Diffstat (limited to 'common/rdr/TLSInStream.cxx')
-rw-r--r--common/rdr/TLSInStream.cxx8
1 files changed, 3 insertions, 5 deletions
diff --git a/common/rdr/TLSInStream.cxx b/common/rdr/TLSInStream.cxx
index e6c9c906..94e6109b 100644
--- a/common/rdr/TLSInStream.cxx
+++ b/common/rdr/TLSInStream.cxx
@@ -93,17 +93,15 @@ size_t TLSInStream::readTLS(U8* buf, size_t len)
{
int n;
- if (gnutls_record_check_pending(session) == 0) {
- if (!in->hasData(1))
- return 0;
- }
-
n = gnutls_record_recv(session, (void *) buf, len);
if (n == GNUTLS_E_INTERRUPTED || n == GNUTLS_E_AGAIN)
return 0;
if (n < 0) throw TLSException("readTLS", n);
+ if (n == 0)
+ throw EndOfStream();
+
return n;
}