Restart client after receiving unknown constructor

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
KurimuzonAkuma 2024-09-04 10:48:29 +03:00 committed by wulan17
parent 4e2d553f35
commit 01e200e8ce
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5

View file

@ -190,14 +190,19 @@ class Session:
await self.start()
async def handle_packet(self, packet):
data = await self.loop.run_in_executor(
pyrogram.crypto_executor,
mtproto.unpack,
BytesIO(packet),
self.session_id,
self.auth_key,
self.auth_key_id
)
try:
data = await self.loop.run_in_executor(
pyrogram.crypto_executor,
mtproto.unpack,
BytesIO(packet),
self.session_id,
self.auth_key,
self.auth_key_id
)
except ValueError as e:
log.debug(e)
self.loop.create_task(self.restart())
return
messages = (
data.body.messages