forked from Krautspace/doorstatus
socket shutdown in finally klausel hinzugefügt
This commit is contained in:
parent
26c695828f
commit
ac1d259a95
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue