Skip to content

Commit

Permalink
Restart client after receiving unknown constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
KurimuzonAkuma committed Sep 4, 2024
1 parent 86e26cc commit 2683e04
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions pyrogram/session/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,19 @@ async def restart(self):
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
Expand Down

0 comments on commit 2683e04

Please sign in to comment.