sixohsix/twitter — pull request #209 by RouxRC (2014-03-09 23:27:32+00:00)
Title: Fix CPU and userstream issues with non blocking streaming modes (follow-up #205)

The problem seems to come from incomplete reads being caught as SSLErrors during the process of recv_chunk. This results in size being read already read and not available anymore for further reading. I fixed it by moving the catching to the level of the atomic read.

I took the occasion and tried to fix the CPU issue I discussed in #205 as well. It seems to me that the blocking mode is already handled by the sock and should not reflect on the part where we check for incoming data. This fixes the CPU issue while still having timeouts work, but I'm not 100% sure this doesn't make it blocking during some parts. Happy to divide the PR if you prefer.