From 95cf873bada593befaaf912aa14c867dca006c03 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Wed, 2 Jan 2019 10:50:43 +0100 Subject: [PATCH] Don't mark the user as connected until successfull connection The idea behind distinguishing between the user being connected and the actual connection having been made was to support retries while the user decided to connect, even if the connection wasn't made yet. The problem is that _user_connected is used directly to tell whether the sender is connected or not which will be wrong if an exception occurs on the initial connection. Since the logic retry isn't used there we can simply mark as connected once a successfull connection is made. --- telethon/network/mtprotosender.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telethon/network/mtprotosender.py b/telethon/network/mtprotosender.py index cff11cfc..71f9664f 100644 --- a/telethon/network/mtprotosender.py +++ b/telethon/network/mtprotosender.py @@ -136,8 +136,8 @@ class MTProtoSender: return self._connection = connection - self._user_connected = True await self._connect() + self._user_connected = True def is_connected(self): return self._user_connected