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:
Lonami Exo 2018-08-20 14:59:17 +02:00
parent 171e13daa9
commit f0cd1fdd6e

View File

@ -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 '