socket shutdown in finally klausel hinzugefügt

This commit is contained in:
+++ 2020-09-08 17:39:39 +02:00
parent 26c695828f
commit ac1d259a95

View file

@ -285,11 +285,15 @@ def main():
conn.send(b'\x03') conn.send(b'\x03')
sleep(0.1) # protection against dos sleep(0.1) # protection against dos
except KeyboardInterrupt: except KeyboardInterrupt:
logging.info('Exit') logging.info('Keyboard interrupt received')
sys.exit(1) sys.exit(1)
except Exception as e: except Exception as e:
logging.error('{}'.format(e)) logging.error('{}'.format(e))
continue continue
finally:
if mySocket:
logging.info('Shutdown socket')
mySocket.shutdown(socket.SHUT_RDWR)
return 0 return 0