Catch more malformed message exceptions
This commit is contained in:
parent
a4f5532f94
commit
1daa561d91
|
@ -215,7 +215,12 @@ class Connection(threading.Thread):
|
||||||
self.buffer_receive = self.buffer_receive[self.next_message_size:]
|
self.buffer_receive = self.buffer_receive[self.next_message_size:]
|
||||||
self.next_message_size = shared.header_length
|
self.next_message_size = shared.header_length
|
||||||
self.last_message_received = time.time()
|
self.last_message_received = time.time()
|
||||||
|
try:
|
||||||
self._process_message(m)
|
self._process_message(m)
|
||||||
|
except ValueError as e:
|
||||||
|
self.status = 'disconnecting'
|
||||||
|
logging.warning('Received malformed message from {}:{}: {}'.format(self.host, self.port, e))
|
||||||
|
break
|
||||||
|
|
||||||
def _process_message(self, m):
|
def _process_message(self, m):
|
||||||
if m.command == b'version':
|
if m.command == b'version':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user