Skip to content

Commit

Permalink
FIX: Stream identification hang #189
Browse files Browse the repository at this point in the history
- fixed termination condition in `blocking_read`.
  • Loading branch information
carlwilson committed May 15, 2020
1 parent e59b8e4 commit 14932c5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fido/fido.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,11 @@ def blocking_read(self, file, bytes_to_read):
buffer = b''
while bytes_read < bytes_to_read:
readbuffer = file.read(bytes_to_read - bytes_read)
last_read_len = len(readbuffer)
buffer += readbuffer
bytes_read = len(buffer)
# break out if EOF is reached.
if readbuffer == '':
bytes_read += last_read_len
# break out if EOF is reached, that is zero bytes read.
if last_read_len < 1:
break
return buffer

Expand Down

0 comments on commit 14932c5

Please sign in to comment.