mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 21:10:29 +00:00
Don't disconnect sender on cancellation (#958)
This was causing a "race condition" where the sender would be disconnected after cancellation when another was created.
This commit is contained in:
@@ -386,7 +386,6 @@ class MTProtoSender:
|
|||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
continue
|
continue
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
await self.disconnect()
|
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if isinstance(e, ConnectionError):
|
if isinstance(e, ConnectionError):
|
||||||
@@ -426,7 +425,6 @@ class MTProtoSender:
|
|||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
continue
|
continue
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
await self.disconnect()
|
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if isinstance(e, ConnectionError):
|
if isinstance(e, ConnectionError):
|
||||||
@@ -470,7 +468,6 @@ class MTProtoSender:
|
|||||||
.format(e.invalid_constructor_id, e.remaining))
|
.format(e.invalid_constructor_id, e.remaining))
|
||||||
continue
|
continue
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
await self.disconnect()
|
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
__log__.exception('Unhandled exception while unpacking %s',e)
|
__log__.exception('Unhandled exception while unpacking %s',e)
|
||||||
@@ -479,7 +476,6 @@ class MTProtoSender:
|
|||||||
try:
|
try:
|
||||||
await self._process_message(message)
|
await self._process_message(message)
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
await self.disconnect()
|
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
__log__.exception('Unhandled exception while '
|
__log__.exception('Unhandled exception while '
|
||||||
|
Reference in New Issue
Block a user