TS-3788: SNI Callbacks stall after TS-3667 fix

(cherry picked from commit ed48c9053c80372413b631be7946b7d30728e9e3)

Conflicts:
        iocore/net/SSLNetVConnection.cc


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f0f22ce1
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f0f22ce1
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f0f22ce1

Branch: refs/heads/5.3.x
Commit: f0f22ce1ac11bb41d09203b6017b2449e237f690
Parents: c022285
Author: shinrich <[email protected]>
Authored: Wed Jul 22 15:06:54 2015 -0500
Committer: Phil Sorber <[email protected]>
Committed: Wed Sep 2 20:05:18 2015 -0600

----------------------------------------------------------------------
 iocore/net/SSLNetVConnection.cc | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f0f22ce1/iocore/net/SSLNetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index 436b3cf..f6bd6b3 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -949,23 +949,14 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
     return EVENT_DONE;
   }
 
-  // All the pre-accept hooks have completed, proceed with the actual accept.
+  int retval = 1; // Initialze with a non-error value
 
+  // All the pre-accept hooks have completed, proceed with the actual accept.
   if (BIO_eof(SSL_get_rbio(this->ssl))) { // No more data in the buffer
     // Read from socket to fill in the BIO buffer with the
     // raw handshake data before calling the ssl accept calls.
-    int retval = this->read_raw_data();
-    if (retval < 0) {
-      if (retval == -EAGAIN) {
-        // No data at the moment, hang tight
-        SSLDebugVC(this, "SSL handshake: EAGAIN");
-        return SSL_HANDSHAKE_WANT_READ;
-      } else {
-        // An error, make us go away
-        SSLDebugVC(this, "SSL handshake error: read_retval=%d", retval);
-        return EVENT_ERROR;
-      }
-    } else if (retval == 0) {
+    retval = this->read_raw_data();
+    if (retval == 0) {
       // EOF, go away, we stopped in the handshake
       SSLDebugVC(this, "SSL handshake error: EOF");
       return EVENT_ERROR;
@@ -1057,6 +1048,15 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
     return SSL_HANDSHAKE_WANT_WRITE;
 
   case SSL_ERROR_WANT_READ:
+    if (retval == -EAGAIN) {
+      // No data at the moment, hang tight
+      SSLDebugVC(this, "SSL handshake: EAGAIN");
+      return SSL_HANDSHAKE_WANT_READ;
+    } else if (retval < 0)  {
+      // An error, make us go away
+      SSLDebugVC(this, "SSL handshake error: read_retval=%d", retval);
+      return EVENT_ERROR;
+    }
     return SSL_HANDSHAKE_WANT_READ;
 
 // This value is only defined in openssl has been patched to

Reply via email to