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.
This commit is contained in:
Lonami Exo 2019-01-02 10:50:43 +01:00
parent 229969192a
commit 95cf873bad

View File

@ -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