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, '
'reading data left:', packet_len)
while True:
data = b''
try:
__log__.error(repr(self.read(1)))
data += self.read(1)
except TimeoutError:
break
finally:
__log__.error(repr(data))
# Connection reset and hope it's fixed after
self.conn.close()
raise ConnectionResetError()