Github user jeking3 commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1476#discussion_r163663584
  
    --- Diff: lib/cpp/src/thrift/transport/TSSLSocket.cpp ---
    @@ -249,6 +249,17 @@ TSSLSocket::~TSSLSocket() {
       close();
     }
     
    +bool TSSLSocket::hasPendingDataToRead() {
    +  if (!isOpen()) {
    +    return false;
    +  }
    +  initializeHandshake();
    +  if (!checkHandshake())
    +    throw TSSLException("SSL_peek: Handshake is not completed");
    +  // data may be available in SSL buffers (note: SSL_pending does not have 
a failure mode)
    +  return TSocket::hasPendingDataToRead() || SSL_pending(ssl_) > 0;
    --- End diff --
    
    Should SSL_pending be checked first for efficiency?  First check the SSL 
buffers, then if those are clear then check the socket.


---

Reply via email to