chg: [server] timeout unvalid connections

pull/23/head
Terrtia 2019-04-03 14:05:16 +02:00
parent 5d923a39e2
commit 9144cd8af1
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
1 changed files with 8 additions and 3 deletions

View File

@ -120,6 +120,11 @@ class D4_Server(Protocol, TimeoutMixin):
self.process_header(data, self.ip, self.source_port) self.process_header(data, self.ip, self.source_port)
def timeoutConnection(self): def timeoutConnection(self):
if self.uuid is None:
# # TODO: ban auto
logger.warning('Timeout, no D4 header send, session_uuid={}, connection closed'.format(self.session_uuid))
self.transport.abortConnection()
else:
self.resetTimeout() self.resetTimeout()
self.buffer = b'' self.buffer = b''
logger.debug('buffer timeout, session_uuid={}'.format(self.session_uuid)) logger.debug('buffer timeout, session_uuid={}'.format(self.session_uuid))