Attempt at making OSError narrower

This commit is contained in:
PhilipTrauner 2016-03-08 08:37:55 +01:00
parent 6510213cfd
commit 8c503a2b1d

View file

@ -43,7 +43,10 @@ class Server:
try:
data, route = sock.recv()
handler.handle(data, route)
except (socket.error, OSError):
except (BrokenPipeError, ConnectionResetError, OSError) as e:
if type(e) is OSError:
if str(e) not in ("Connection closed", "Bad file descriptor"):
raise
handler.finish()
if sock in self.socks:
del self.socks[self.socks.index(sock)]