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