This is an automated email from the ASF dual-hosted git repository.

jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new b33130f  THRIFT-4559: TSSLSocket no longer prints incorrect error for 
SYSCALL (#1549)
b33130f is described below

commit b33130f67964813169003fcbb4b7acc535082b5a
Author: Sidneys1 <[email protected]>
AuthorDate: Wed May 2 13:39:49 2018 -0400

    THRIFT-4559: TSSLSocket no longer prints incorrect error for SYSCALL (#1549)
    
    Client: cpp
---
 lib/cpp/src/thrift/transport/TSSLSocket.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.cpp 
b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
index 7071698..251ef2f 100644
--- a/lib/cpp/src/thrift/transport/TSSLSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
@@ -403,11 +403,16 @@ uint32_t TSSLSocket::read(uint8_t* buf, uint32_t len) {
       break;
     }
     unsigned int waitEventReturn;
+    bool breakout = false;
     switch (error) {
       case SSL_ERROR_ZERO_RETURN:
         throw TTransportException(TTransportException::END_OF_FILE, "client 
disconnected");
 
       case SSL_ERROR_SYSCALL:
+        if (errno_copy == 0 && ERR_peek_error() == 0) {
+          breakout = true;
+          break;
+        }
         if ((errno_copy != THRIFT_EINTR)
             && (errno_copy != THRIFT_EAGAIN)) {
               break;
@@ -450,6 +455,9 @@ uint32_t TSSLSocket::read(uint8_t* buf, uint32_t len) {
         throw TTransportException(TTransportException::INTERNAL_ERROR, "unkown 
waitForEvent return value");
       default:;// do nothing
     }
+    if (breakout) {
+      break;
+    }
     string errors;
     buildErrors(errors, errno_copy, error);
     throw TSSLException("SSL_read: " + errors);
@@ -1024,6 +1032,14 @@ void buildErrors(string& errors, int errno_copy, int 
sslerrno) {
   }
   if (sslerrno) {
     errors += " (SSL_error_code = " + to_string(sslerrno) + ")";
+    if (sslerrno == SSL_ERROR_SYSCALL) {
+      char buf[4096];
+      int err;
+      while ((err = ERR_get_error()) != 0) {
+        errors += " ";
+        errors += ERR_error_string(err, buf);
+      }
+    }
   }
 }
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to