Don't log broken packets as individual bytes

This commit is contained in:
Lonami Exo 2018-04-14 15:02:27 +02:00
parent 75d37a3870
commit ace715e059

View File

@ -191,10 +191,13 @@ class Connection:
__log__.error('Read invalid packet length %d, ' __log__.error('Read invalid packet length %d, '
'reading data left:', packet_len) 'reading data left:', packet_len)
while True: while True:
data = b''
try: try:
__log__.error(repr(self.read(1))) data += self.read(1)
except TimeoutError: except TimeoutError:
break break
finally:
__log__.error(repr(data))
# Connection reset and hope it's fixed after # Connection reset and hope it's fixed after
self.conn.close() self.conn.close()
raise ConnectionResetError() raise ConnectionResetError()