Fix logging bug on disconnect

This commit is contained in:
Lonami Exo 2019-08-08 09:32:18 +02:00
parent c0e4d6c8b6
commit f5de2cd9a0

View File

@ -258,7 +258,6 @@ class MTProtoSender:
self._log.debug('Closing current connection...')
await self._connection.disconnect()
finally:
self._connection = None
self._log.debug('Cancelling %d pending message(s)...', len(self._pending_state))
for state in self._pending_state.values():
if error and not state.future.done():
@ -273,7 +272,9 @@ class MTProtoSender:
recv_loop_handle=self._recv_loop_handle
)
self._log.info('Disconnection from %s complete!', self._connection)
self._log.info('Disconnection from %s complete!', self._connection)
self._connection = None
if self._disconnected and not self._disconnected.done():
if error:
self._disconnected.set_exception(error)