diff options
-rw-r--r-- | termcast_server/termcast.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/termcast_server/termcast.py b/termcast_server/termcast.py index a2318d6..1bb6d15 100644 --- a/termcast_server/termcast.py +++ b/termcast_server/termcast.py @@ -229,7 +229,10 @@ class Connection(object): def _readline(self): buf = b'' while len(buf) < 1024 and b"\n" not in buf: - buf += self.client.recv(1) + byte = self.client.recv(1) + if len(byte) == 0: + raise Exception("Connection closed unexpectedly") + buf += byte pos = buf.find(b"\n") if pos == -1: |