event: client_exit: bugfixes

This commit is contained in:
Oleksii Shevchuk 2018-10-27 10:03:02 +03:00
parent 263afbba63
commit 196682dfda
2 changed files with 8 additions and 4 deletions

View File

@ -145,13 +145,17 @@ if not sys.platform == 'win32' and not pupy.pseudo:
def defered_close_exit(connection):
try:
broadcast_event(0x20000000 | 0xFFFF)
# Should be the custom event, as generated on client
broadcast_event(0x10000000 | 0xFFFF)
except Exception, e:
logger.exception(e)
logger.debug('Defered close+exit')
sys.terminated = True
connection.close()
if connection:
connection.close()
def broadcast_event(eventid):
if pupy.connection:
@ -757,7 +761,7 @@ def handle_sigterm(signal, frame):
defered_close_exit,
pupy.connection)
else:
sys.terminated = True
defered_close_exit(None)
logger.warning('SIGTERM HANDLED')

View File

@ -33,7 +33,7 @@ ON_CONNECT = CLIENT | 0
ON_DISCONNECT = CLIENT | 1
ON_JOB_EXIT = CLIENT | 2
ON_CLIENT_EXIT = CLIENT | 0xFFFF
ON_CLIENT_EXIT = CUSTOM | 0xFFFF
ON_DNSCNC_SESSION = DNSCNC | 0
ON_DNSCNC_SESSION_LOST = DNSCNC | 1