From: Pierre Ossman Date: Wed, 20 May 2020 18:03:11 +0000 (+0200) Subject: Log I/O errors from TLS streams X-Git-Tag: v1.11.90~74^2~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f4fdc13f37f7ae67b2ba110c24366f84e1e70734;p=tigervnc.git Log I/O errors from TLS streams --- diff --git a/common/rdr/TLSInStream.cxx b/common/rdr/TLSInStream.cxx index 70303db0..ba20e752 100644 --- a/common/rdr/TLSInStream.cxx +++ b/common/rdr/TLSInStream.cxx @@ -25,11 +25,14 @@ #include #include #include +#include #include #ifdef HAVE_GNUTLS using namespace rdr; +static rfb::LogWriter vlog("TLSInStream"); + ssize_t TLSInStream::pull(gnutls_transport_ptr_t str, void* data, size_t size) { TLSInStream* self= (TLSInStream*) str; @@ -45,8 +48,10 @@ ssize_t TLSInStream::pull(gnutls_transport_ptr_t str, void* data, size_t size) size = in->avail(); in->readBytes(data, size); - + } catch (EndOfStream&) { + return 0; } catch (Exception& e) { + vlog.error("Failure reading TLS data: %s", e.str()); gnutls_transport_set_errno(self->session, EINVAL); return -1; } diff --git a/common/rdr/TLSOutStream.cxx b/common/rdr/TLSOutStream.cxx index 7d59a9c7..a883fe89 100644 --- a/common/rdr/TLSOutStream.cxx +++ b/common/rdr/TLSOutStream.cxx @@ -25,11 +25,14 @@ #include #include #include +#include #include #ifdef HAVE_GNUTLS using namespace rdr; +static rfb::LogWriter vlog("TLSOutStream"); + enum { DEFAULT_BUF_SIZE = 16384 }; ssize_t TLSOutStream::push(gnutls_transport_ptr_t str, const void* data, @@ -42,6 +45,7 @@ ssize_t TLSOutStream::push(gnutls_transport_ptr_t str, const void* data, out->writeBytes(data, size); out->flush(); } catch (Exception& e) { + vlog.error("Failure sending TLS data: %s", e.str()); gnutls_transport_set_errno(self->session, EINVAL); return -1; }