From ac1d259a9568743d15433c91ebc5e4fca432a0ba Mon Sep 17 00:00:00 2001 From: +++ Date: Tue, 8 Sep 2020 17:39:39 +0200 Subject: [PATCH] =?UTF-8?q?socket=20shutdown=20in=20finally=20klausel=20hi?= =?UTF-8?q?nzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- statusd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/statusd.py b/statusd.py index 7581114..6d5a908 100755 --- a/statusd.py +++ b/statusd.py @@ -285,11 +285,15 @@ def main(): conn.send(b'\x03') sleep(0.1) # protection against dos except KeyboardInterrupt: - logging.info('Exit') + logging.info('Keyboard interrupt received') sys.exit(1) except Exception as e: logging.error('{}'.format(e)) continue + finally: + if mySocket: + logging.info('Shutdown socket') + mySocket.shutdown(socket.SHUT_RDWR) return 0