From 2922e8df112ff043d09e30775459223def0c171d Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Mon, 7 May 2018 16:46:58 +0200 Subject: [PATCH] Fix still broken log for broken packets --- telethon/network/connection.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/telethon/network/connection.py b/telethon/network/connection.py index a8c70876..a877ac0f 100644 --- a/telethon/network/connection.py +++ b/telethon/network/connection.py @@ -190,14 +190,15 @@ class Connection: if packet_len <= 12: __log__.error('Read invalid packet length %d, ' 'reading data left:', packet_len) - while True: - data = b'' - try: + data = b'' + try: + while True: data += self.read(1) - except TimeoutError: - break - finally: - __log__.error(repr(data)) + except TimeoutError: + pass + finally: + __log__.error(repr(data)) + # Connection reset and hope it's fixed after self.conn.close() raise ConnectionResetError()