Attempt at making OSError narrower
This commit is contained in:
parent
6510213cfd
commit
8c503a2b1d
1 changed files with 4 additions and 1 deletions
|
@ -43,7 +43,10 @@ class Server:
|
||||||
try:
|
try:
|
||||||
data, route = sock.recv()
|
data, route = sock.recv()
|
||||||
handler.handle(data, route)
|
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()
|
handler.finish()
|
||||||
if sock in self.socks:
|
if sock in self.socks:
|
||||||
del self.socks[self.socks.index(sock)]
|
del self.socks[self.socks.index(sock)]
|
||||||
|
|
Reference in a new issue