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