- if ready_to_read[0]:
- buf += recv_chunk(sock).decode('utf-8') # This is a non-blocking read.
- if time.time() - timer > self.timeout:
- yield {'timeout': True}
- else: yield {'timeout': True}
- else:
- buf += recv_chunk(sock).decode('utf-8')
- if not buf and self.block:
+ if not ready_to_read[0] and time.time() - timer > self.timeout:
+ yield {'timeout': True}
+ continue
+ timer = time.time()
+ buf += recv_chunk(sock).decode('utf-8')
+ if not buf: