Skip to content

Commit 14932c5

Browse files
committed
FIX: Stream identification hang #189
- fixed termination condition in `blocking_read`.
1 parent e59b8e4 commit 14932c5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fido/fido.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,11 @@ def blocking_read(self, file, bytes_to_read):
512512
buffer = b''
513513
while bytes_read < bytes_to_read:
514514
readbuffer = file.read(bytes_to_read - bytes_read)
515+
last_read_len = len(readbuffer)
515516
buffer += readbuffer
516-
bytes_read = len(buffer)
517-
# break out if EOF is reached.
518-
if readbuffer == '':
517+
bytes_read += last_read_len
518+
# break out if EOF is reached, that is zero bytes read.
519+
if last_read_len < 1:
519520
break
520521
return buffer
521522

0 commit comments

Comments
 (0)