From: Pierre Ossman Date: Thu, 10 Jun 2021 14:32:29 +0000 (+0200) Subject: Remove early data check for TLSInStream X-Git-Tag: v1.11.90~39^2~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d1ad6b5c250d0bc4c43b4d9983badf8ce01b5747;p=tigervnc.git 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). --- 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; }