]> source.dussan.org Git - tigervnc.git/commitdiff
Log I/O errors from TLS streams
authorPierre Ossman <ossman@cendio.se>
Wed, 20 May 2020 18:03:11 +0000 (20:03 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 21 May 2020 09:34:22 +0000 (11:34 +0200)
common/rdr/TLSInStream.cxx
common/rdr/TLSOutStream.cxx

index 70303db09e396bdc5544bfda9e621b83c95d7d04..ba20e752ffb608a57f2c58055541ad95340e4a29 100644 (file)
 #include <rdr/Exception.h>
 #include <rdr/TLSException.h>
 #include <rdr/TLSInStream.h>
+#include <rfb/LogWriter.h>
 #include <errno.h>
 
 #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;
   }
index 7d59a9c789a6660cfd6ccaac2a17854cfcaba70d..a883fe89f4cbc6a902ff1354366a796c20c24c0a 100644 (file)
 #include <rdr/Exception.h>
 #include <rdr/TLSException.h>
 #include <rdr/TLSOutStream.h>
+#include <rfb/LogWriter.h>
 #include <errno.h>
 
 #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;
   }