Github user jeking3 commented on the issue: https://github.com/apache/thrift/pull/1476 I see now, I may have led you down the wrong path with my comments. So peek() blocks waiting for data the be available to read and the end result of peek is that there is data to read OR the socket disconnected. What you are looking for is a call to see if the socket has data available but does not block. As such, those are different code paths... Perhaps your original code before this last push was correct. I will take another look.
---