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')
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue