From 4af920094a78f751b760d1fb55ca29227f0361cd Mon Sep 17 00:00:00 2001 From: David Wilson Date: Fri, 29 Sep 2017 16:38:59 +0530 Subject: [PATCH] iter_read: also treat 0-byte read as disconnection --- mitogen/master.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mitogen/master.py b/mitogen/master.py index 5aef0ec9..c3a52788 100644 --- a/mitogen/master.py +++ b/mitogen/master.py @@ -174,7 +174,8 @@ def iter_read(fd, deadline=None): continue s, disconnected = mitogen.core.io_op(os.read, fd, 4096) - if disconnected: + IOLOG.debug('iter_read(%r) -> %r', fd, s) + if disconnected or not s: raise mitogen.core.StreamError( 'EOF on stream; last 300 bytes received: %r' % (''.join(bits)[-300:],)