From f0cd1fdd6eb905dc52e7732a29d0a856d128605b Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Mon, 20 Aug 2018 14:59:17 +0200 Subject: [PATCH] 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. --- telethon/network/mtprotosender.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/telethon/network/mtprotosender.py b/telethon/network/mtprotosender.py index 7d8dfd13..16e00b18 100644 --- a/telethon/network/mtprotosender.py +++ b/telethon/network/mtprotosender.py @@ -386,7 +386,6 @@ class MTProtoSender: except asyncio.TimeoutError: continue except asyncio.CancelledError: - await self.disconnect() return except Exception as e: if isinstance(e, ConnectionError): @@ -426,7 +425,6 @@ class MTProtoSender: except asyncio.TimeoutError: continue except asyncio.CancelledError: - await self.disconnect() return except Exception as e: if isinstance(e, ConnectionError): @@ -470,7 +468,6 @@ class MTProtoSender: .format(e.invalid_constructor_id, e.remaining)) continue except asyncio.CancelledError: - await self.disconnect() return except Exception as e: __log__.exception('Unhandled exception while unpacking %s',e) @@ -479,7 +476,6 @@ class MTProtoSender: try: await self._process_message(message) except asyncio.CancelledError: - await self.disconnect() return except Exception as e: __log__.exception('Unhandled exception while '