Fix unhandled exception in case the connection is already closed

This commit is contained in:
Dan 2017-12-18 13:50:00 +01:00
parent 316c426429
commit dde01cc9b9

View File

@ -33,7 +33,11 @@ class TCP(socket.socket):
pass
def close(self):
try:
self.shutdown(socket.SHUT_RDWR)
except OSError:
pass
finally:
super().close()
def recvall(self, length: int) -> bytes or None: