@@ -65,10 +65,12 @@ def recv( maxlen ):
6565 remains = latency if timeout is None else min ( # If no timeout, wait for latency (or forever, if None)
6666 timeout if latency is None else latency , # Or, we know timeout is numeric; get min of any latency
6767 max ( timeout - duration , 0 )) # ... and remaining unused timeout
68- return network .recv ( conn , maxlen = maxlen , timeout = remains )
68+ data = network .recv ( conn , maxlen = maxlen , timeout = remains ) # None (timeout) / b'' (EOF) / b'...'
69+ #log.warning( "recv: {data!r}".format( data=data ))
70+ return data
6971
70- length ,c = b'' ,b'0'
71- while not server .done and c in b'01234567889' or ( ignore and c in ignore ):
72+ length ,c = b'' ,b'0' # remember: b'' is trivially considered as "in" b'...'
73+ while not server .done and c and c in b'01234567889' or ( ignore and c in ignore ):
7274 if not ignore or c not in ignore :
7375 assert c in b'0123456789' , "Expected TNET size symbol, not {c!r}" .format ( c = c ) # EOF/timeout
7476 length += c
@@ -79,7 +81,7 @@ def recv( maxlen ):
7981 # No data w/in given timeout expiry! Inform the consumer, and then try again w/ fresh timeout.
8082 yield None
8183 started = cpppo .timer ()
82- if server .done or c == b'' : return # done/EOF
84+ if server .done or not c : return # None/ b'' ==> done/EOF
8385 assert c == b':' , "Expected TNET <size> separator ':', not {c!r}" .format ( c = c )
8486 length = int ( length )
8587
0 commit comments