From c5e969d5854bbb44d895fcf19563606aaecab07e Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 13 Jan 2018 19:26:45 +0100 Subject: [PATCH] Add more useful logging on invalid packet length received --- telethon/network/connection.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/telethon/network/connection.py b/telethon/network/connection.py index ff255d00..0adaf98a 100644 --- a/telethon/network/connection.py +++ b/telethon/network/connection.py @@ -2,6 +2,7 @@ This module holds both the Connection class and the ConnectionMode enum, which specifies the protocol to be used by the Connection. """ +import logging import os import struct from datetime import timedelta @@ -14,6 +15,8 @@ from ..crypto import AESModeCTR from ..extensions import TcpClient from ..errors import InvalidChecksumError +__log__ = logging.getLogger(__name__) + class ConnectionMode(Enum): """Represents which mode should be used to stabilise a connection. @@ -181,6 +184,21 @@ class Connection: packet_len_seq = self.read(8) # 4 and 4 packet_len, seq = struct.unpack('