From a46a50fd7439cddabccc0102f3f0494be2ca607c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 19 Oct 2018 18:05:08 +0200 Subject: [PATCH] server: Close the socket even if shutdown() raises an exception. --- matrix/server.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/matrix/server.py b/matrix/server.py index 1057ff7..94922a5 100644 --- a/matrix/server.py +++ b/matrix/server.py @@ -459,10 +459,14 @@ class MatrixServer(object): if self.socket: try: self.socket.shutdown(socket.SHUT_RDWR) - self.socket.close() except socket.error: pass + try: + self.socket.close() + except OSError: + pass + def disconnect(self, reconnect=True): # type: (bool) -> None if self.fd_hook: