2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +00:00

Use a better variable name

This commit is contained in:
Dan 2018-02-08 17:34:00 +01:00
parent 3097cadd8a
commit 00631fcc33

View File

@ -264,34 +264,34 @@ class Session:
log.debug(data) log.debug(data)
for i in messages: for msg in messages:
if i.seq_no % 2 != 0: if msg.seq_no % 2 != 0:
if i.msg_id in self.pending_acks: if msg.msg_id in self.pending_acks:
continue continue
else: else:
self.pending_acks.add(i.msg_id) self.pending_acks.add(msg.msg_id)
if isinstance(i.body, (types.MsgDetailedInfo, types.MsgNewDetailedInfo)): if isinstance(msg.body, (types.MsgDetailedInfo, types.MsgNewDetailedInfo)):
self.pending_acks.add(i.body.answer_msg_id) self.pending_acks.add(msg.body.answer_msg_id)
continue continue
if isinstance(i.body, types.NewSessionCreated): if isinstance(msg.body, types.NewSessionCreated):
continue continue
msg_id = None msg_id = None
if isinstance(i.body, (types.BadMsgNotification, types.BadServerSalt)): if isinstance(msg.body, (types.BadMsgNotification, types.BadServerSalt)):
msg_id = i.body.bad_msg_id msg_id = msg.body.bad_msg_id
elif isinstance(i.body, (core.FutureSalts, types.RpcResult)): elif isinstance(msg.body, (core.FutureSalts, types.RpcResult)):
msg_id = i.body.req_msg_id msg_id = msg.body.req_msg_id
elif isinstance(i.body, types.Pong): elif isinstance(msg.body, types.Pong):
msg_id = i.body.msg_id msg_id = msg.body.msg_id
else: else:
if self.update_handler: if self.update_handler:
self.update_handler(self.client, i.body) self.update_handler(self.client, msg.body)
if msg_id in self.results: if msg_id in self.results:
self.results[msg_id].value = getattr(i.body, "result", i.body) self.results[msg_id].value = getattr(msg.body, "result", msg.body)
self.results[msg_id].event.set() self.results[msg_id].event.set()
if len(self.pending_acks) >= self.ACKS_THRESHOLD: if len(self.pending_acks) >= self.ACKS_THRESHOLD: