From bf56d3211828f34b024c7660accd963d933a369a Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Tue, 30 Jan 2018 18:32:42 +0100 Subject: [PATCH] Add missing FutureSalts response special case (#81) --- telethon/network/mtproto_sender.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/telethon/network/mtproto_sender.py b/telethon/network/mtproto_sender.py index 0e960181..877611df 100644 --- a/telethon/network/mtproto_sender.py +++ b/telethon/network/mtproto_sender.py @@ -4,11 +4,9 @@ encrypting every packet, and relies on a valid AuthKey in the used Session. """ import gzip import logging -import struct from threading import Lock from .. import helpers as utils -from ..crypto import AES from ..errors import ( BadMessageError, InvalidChecksumError, BrokenAuthKeyError, rpc_message_to_error @@ -16,11 +14,11 @@ from ..errors import ( from ..extensions import BinaryReader from ..tl import TLMessage, MessageContainer, GzipPacked from ..tl.all_tlobjects import tlobjects +from ..tl.functions.auth import LogOutRequest from ..tl.types import ( - MsgsAck, Pong, BadServerSalt, BadMsgNotification, + MsgsAck, Pong, BadServerSalt, BadMsgNotification, FutureSalts, MsgNewDetailedInfo, NewSessionCreated, MsgDetailedInfo ) -from ..tl.functions.auth import LogOutRequest __log__ = logging.getLogger(__name__) @@ -244,6 +242,12 @@ class MtProtoSender: return True + if isinstance(obj, FutureSalts): + r = self._pop_request(obj.req_msg_id) + if r: + r.result = obj + r.confirm_received.set() + # If the object isn't any of the above, then it should be an Update. self.session.process_entities(obj) if state: