mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-26 09:14:31 +03:00
Fix exception ignored warnings and invalid state #935
This commit is contained in:
parent
d0c566bbdb
commit
a688c8a4ce
|
@ -151,7 +151,14 @@ class TcpClient:
|
|||
loop=self._loop
|
||||
)
|
||||
for r in running:
|
||||
r.cancel()
|
||||
if not r.cancelled():
|
||||
if r.done():
|
||||
# Retrieve exception to avoid "not retrieved" errors
|
||||
r.exception()
|
||||
|
||||
# Cancel the future despite its state
|
||||
r.cancel()
|
||||
|
||||
if not self.is_connected:
|
||||
raise self.SocketClosed()
|
||||
if not done:
|
||||
|
|
|
@ -167,7 +167,7 @@ class MTProtoSender:
|
|||
self._recv_loop_handle.cancel()
|
||||
|
||||
__log__.info('Disconnection from {} complete!'.format(self._ip))
|
||||
if self._disconnected:
|
||||
if self._disconnected and not self._disconnected.done():
|
||||
if error:
|
||||
self._disconnected.set_exception(error)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue
Block a user