Catch exceptions while trying to close the socket.

This commit is contained in:
poljar (Damir Jelić) 2018-02-03 12:51:13 +01:00
parent 475feaa93a
commit 41c96fd332

View file

@ -316,8 +316,11 @@ class MatrixServer:
def _close_socket(self): def _close_socket(self):
# type: (socket.socket) -> None # type: (socket.socket) -> None
if self.socket: if self.socket:
try:
self.socket.shutdown(socket.SHUT_RDWR) self.socket.shutdown(socket.SHUT_RDWR)
self.socket.close() self.socket.close()
except OSError:
pass
def disconnect(self, reconnect=True): def disconnect(self, reconnect=True):
# type: (MatrixServer) -> None # type: (MatrixServer) -> None