Github user bgedik commented on a diff in the pull request: https://github.com/apache/thrift/pull/1476#discussion_r163681677 --- Diff: lib/cpp/src/thrift/transport/TSSLSocket.h --- @@ -78,6 +78,7 @@ class TSSLSocket : public TSocket { bool peek(); void open(); void close(); + bool hasPendingDataToRead(); --- End diff -- Sam applies to ``read``. This goes back to my original point. TSocket should behave differently for blocking vs non-blocking socket. Look at how ``TSocket`` and ``TSSLSocket`` handle ``read``s on a non-blocking socket. They throw exceptions. Luckily for me, when not using SSL, ``TNonBlockingServer`` does not ever call ``read`` on a socket that is not ready to consume data. However, that is not the case for ``SSL``. Read calls in ``TNonBlockingServer`` are retried by catching the exception and searching for ``"retry"`` in the exception message. The correct way to fix all this mess is to make ``TSocket`` aware of whether the socket is blocking and non-blocking and behave accordingly. Converting EAGAIN to an exception in the case of non-blocking sockets is a major performance hit. My suggesting is to handle the issue of making ``TSocket`` and ``TSSLSocket`` aware of the blocking/non-blocking nature of the socket in a separate Jira issue.
---