Catch more malformed message exceptions

This commit is contained in:
TheKysek 2016-10-21 20:09:19 +02:00
parent a4f5532f94
commit 1daa561d91

View File

@ -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()
self._process_message(m) try:
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':