mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +03:00
Fix disconnection without a previous connection
This commit is contained in:
parent
b31b239088
commit
c1be0bd2e8
|
@ -251,12 +251,17 @@ class MTProtoSender:
|
|||
self._log.info('Connection to %s complete!', self._connection)
|
||||
|
||||
async def _disconnect(self, error=None):
|
||||
if self._connection is None:
|
||||
self._log.info('Not disconnecting (already have no connection)')
|
||||
return
|
||||
|
||||
self._log.info('Disconnecting from %s...', self._connection)
|
||||
self._user_connected = False
|
||||
try:
|
||||
self._log.debug('Closing current connection...')
|
||||
await self._connection.disconnect()
|
||||
finally:
|
||||
self._connection = None
|
||||
self._log.debug('Cancelling {} pending message(s)...'
|
||||
.format(len(self._pending_state)))
|
||||
for state in self._pending_state.values():
|
||||
|
|
Loading…
Reference in New Issue
Block a user