From b1439dc8ba3cff9494b34d9fd5d790d5e25fe398 Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Tue, 30 Oct 2018 19:37:13 +0200 Subject: [PATCH] dnscnc: Fire event on connection error --- pupy/network/lib/launchers/dnscnc.py | 8 +++++++- pupy/pupylib/PupyTriggers.py | 7 +++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pupy/network/lib/launchers/dnscnc.py b/pupy/network/lib/launchers/dnscnc.py index d64b1e15..064fede6 100644 --- a/pupy/network/lib/launchers/dnscnc.py +++ b/pupy/network/lib/launchers/dnscnc.py @@ -407,7 +407,13 @@ class DNSCncLauncher(BaseLauncher): wait = True elif command[0] == 'connect': - connection = self.on_connect(command) + try: + connection = self.on_connect(command) + except socket.error: + pass + + if not connection: + self.event(0x20000000 | 0xFFFE) if wait: sleep(5) diff --git a/pupy/pupylib/PupyTriggers.py b/pupy/pupylib/PupyTriggers.py index 75294dfc..53d32fc3 100644 --- a/pupy/pupylib/PupyTriggers.py +++ b/pupy/pupylib/PupyTriggers.py @@ -34,6 +34,7 @@ ON_DISCONNECT = CLIENT | 1 ON_JOB_EXIT = CLIENT | 2 ON_CLIENT_EXIT = CUSTOM | 0xFFFF +ON_CLIENT_CONNECTION_FAILED = CUSTOM | 0xFFFE ON_DNSCNC_SESSION = DNSCNC | 0 ON_DNSCNC_SESSION_LOST = DNSCNC | 1 @@ -52,7 +53,6 @@ ON_EXIT = SERVER | 1 EVENTS_ID_REGISTRY = { ON_START: 'start', ON_EXIT: 'exit', - ON_CLIENT_EXIT: 'client_exit', ON_CONNECT: 'connect', ON_DISCONNECT: 'disconnect', ON_JOB_EXIT: 'job completed', @@ -65,7 +65,10 @@ EVENTS_ID_REGISTRY = { ON_DNSCNC_USER_INACTIVE: 'dnscnc user inactive', ON_DNSCNC_HIGH_RESOURCE_USAGE: 'dnscnc high resource usage', ON_DNSCNC_USERS_INCREMENT: 'dnscnc users increment', - ON_DNSCNC_USERS_DECREMENT: 'dnscnc users decrement' + ON_DNSCNC_USERS_DECREMENT: 'dnscnc users decrement', + + ON_CLIENT_EXIT: 'client_exit', + ON_CLIENT_CONNECTION_FAILED: 'dnscnc connection failed' } class EventRegistrationException(Exception):