server: Close the socket even if shutdown() raises an exception.

This commit is contained in:
Damir Jelić 2018-10-19 18:05:08 +02:00
parent fbf56d3491
commit a46a50fd74

View file

@ -459,10 +459,14 @@ class MatrixServer(object):
if self.socket: if self.socket:
try: try:
self.socket.shutdown(socket.SHUT_RDWR) self.socket.shutdown(socket.SHUT_RDWR)
self.socket.close()
except socket.error: except socket.error:
pass pass
try:
self.socket.close()
except OSError:
pass
def disconnect(self, reconnect=True): def disconnect(self, reconnect=True):
# type: (bool) -> None # type: (bool) -> None
if self.fd_hook: if self.fd_hook: