diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-16 13:29:57 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-16 13:29:57 -0400 |
commit | 234d6acf4f60be2371ab9d207eb781ded2a23360 (patch) | |
tree | 2624b7e522818eb2fe1685b2a648d88896b1ffe7 /termcast_server | |
parent | c3f0dd84b4937f2dea495733b1006a3862fd970e (diff) | |
download | python-termcast-server-234d6acf4f60be2371ab9d207eb781ded2a23360.tar.gz python-termcast-server-234d6acf4f60be2371ab9d207eb781ded2a23360.zip |
notice closed connections when we try to read
Diffstat (limited to 'termcast_server')
-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: |