From 316c426429f12e188037b24f93683ca794422c4d Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 18 Dec 2017 09:50:41 +0100 Subject: [PATCH] Handle non-existent auth_key_id errors --- pyrogram/session/session.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py index 343a4086..1c90bc7a 100644 --- a/pyrogram/session/session.py +++ b/pyrogram/session/session.py @@ -29,7 +29,7 @@ from threading import Event, Thread from pyrogram import __copyright__, __license__, __version__ from pyrogram.api import functions, types, core from pyrogram.api.all import layer -from pyrogram.api.core import Message, Object, MsgContainer, Long, FutureSalt +from pyrogram.api.core import Message, Object, MsgContainer, Long, FutureSalt, Int from pyrogram.api.errors import Error from pyrogram.connection import Connection from pyrogram.crypto import IGE, KDF2 @@ -382,7 +382,7 @@ class Session: while True: packet = self.connection.recv() - if packet is None: + if packet is None or (len(packet) == 4 and Int.read(BytesIO(packet)) == -404): if self.is_connected.is_set(): Thread(target=self.restart, name="RestartThread").start() break