From a41bc90c46debc8fca8a35c5dc57c6216897a770 Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Wed, 8 Mar 2017 19:40:01 +0200 Subject: [PATCH] Close socket on strange errors and that's it --- pupy/packages/all/pyuvproxy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pupy/packages/all/pyuvproxy.py b/pupy/packages/all/pyuvproxy.py index 4bfbbc96..b3ff8fdd 100644 --- a/pupy/packages/all/pyuvproxy.py +++ b/pupy/packages/all/pyuvproxy.py @@ -184,8 +184,11 @@ class Connection(object): def close(self, reason, mutual=True): if mutual: - self.loop.queue_work(lambda: self.socket.shutdown( - lambda handle, error: self._report_close_remote(reason))) + try: + self.loop.queue_work(lambda: self.socket.shutdown( + lambda handle, error: self._report_close_remote(reason))) + except: + self.socket.close() else: self.socket.close()