Fix automatic reconnect (e.g. on bad auth key)

This took more time than it should have to debug.
This commit is contained in:
Lonami Exo 2018-10-03 14:15:51 +02:00
parent bc1fd9039d
commit 3fd7c33127

View File

@ -14,6 +14,10 @@ class ConnectionTcpFull(Connection):
super().__init__(ip, port, loop=loop) super().__init__(ip, port, loop=loop)
self._send_counter = 0 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): def _send(self, data):
# https://core.telegram.org/mtproto#tcp-transport # https://core.telegram.org/mtproto#tcp-transport
# total length, sequence number, packet and checksum (CRC32) # total length, sequence number, packet and checksum (CRC32)