From 3fd7c331273f9fadacae1fcb0ff51b9817b009e3 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Wed, 3 Oct 2018 14:15:51 +0200 Subject: [PATCH] Fix automatic reconnect (e.g. on bad auth key) This took more time than it should have to debug. --- telethon/network/connection/tcpfull.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/telethon/network/connection/tcpfull.py b/telethon/network/connection/tcpfull.py index 5825e68b..e07e3558 100644 --- a/telethon/network/connection/tcpfull.py +++ b/telethon/network/connection/tcpfull.py @@ -14,6 +14,10 @@ class ConnectionTcpFull(Connection): super().__init__(ip, port, loop=loop) self._send_counter = 0 + async def connect(self): + await super().connect() + self._send_counter = 0 # Important or Telegram won't reply + def _send(self, data): # https://core.telegram.org/mtproto#tcp-transport # total length, sequence number, packet and checksum (CRC32)