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

    https://github.com/apache/thrift/pull/1476#discussion_r163664502
  
    --- 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 --
    
    I think my comments were wrong; peek blocks until there is something to do 
when the socket is a blocking socket.  I think that if the socket knew it was 
non-blocking then a call to peek() would behave like a call to 
hasPendingDataToRead, i.e. it would be a non-blocking call.  Perhaps that's a 
better way to approach it, but I would have to look at the code a little more 
closely.  I think the original intention of my comment was correct, there 
should be only one way to peek.  Calling peek() on a non-blocking socket should 
not block; calling peek() on a blocking socket should block.


---

Reply via email to