mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +00:00
Clean
This commit is contained in:
parent
a2d435b25f
commit
3097cadd8a
@ -254,7 +254,6 @@ class Session:
|
|||||||
self.update_handler = update_handler
|
self.update_handler = update_handler
|
||||||
|
|
||||||
def unpack_dispatch_and_ack(self, packet: bytes):
|
def unpack_dispatch_and_ack(self, packet: bytes):
|
||||||
# TODO: A better dispatcher
|
|
||||||
data = self.unpack(BytesIO(packet))
|
data = self.unpack(BytesIO(packet))
|
||||||
|
|
||||||
messages = (
|
messages = (
|
||||||
@ -265,9 +264,6 @@ class Session:
|
|||||||
|
|
||||||
log.debug(data)
|
log.debug(data)
|
||||||
|
|
||||||
self.total_bytes += len(packet)
|
|
||||||
self.total_messages += len(messages)
|
|
||||||
|
|
||||||
for i in messages:
|
for i in messages:
|
||||||
if i.seq_no % 2 != 0:
|
if i.seq_no % 2 != 0:
|
||||||
if i.msg_id in self.pending_acks:
|
if i.msg_id in self.pending_acks:
|
||||||
@ -275,8 +271,6 @@ class Session:
|
|||||||
else:
|
else:
|
||||||
self.pending_acks.add(i.msg_id)
|
self.pending_acks.add(i.msg_id)
|
||||||
|
|
||||||
# log.debug("{}".format(type(i.body)))
|
|
||||||
|
|
||||||
if isinstance(i.body, (types.MsgDetailedInfo, types.MsgNewDetailedInfo)):
|
if isinstance(i.body, (types.MsgDetailedInfo, types.MsgNewDetailedInfo)):
|
||||||
self.pending_acks.add(i.body.answer_msg_id)
|
self.pending_acks.add(i.body.answer_msg_id)
|
||||||
continue
|
continue
|
||||||
@ -300,14 +294,6 @@ class Session:
|
|||||||
self.results[msg_id].value = getattr(i.body, "result", i.body)
|
self.results[msg_id].value = getattr(i.body, "result", i.body)
|
||||||
self.results[msg_id].event.set()
|
self.results[msg_id].event.set()
|
||||||
|
|
||||||
# print(
|
|
||||||
# "This packet bytes: ({}) | Total bytes: ({})\n"
|
|
||||||
# "This packet messages: ({}) | Total messages: ({})\n"
|
|
||||||
# "Total connections: ({})".format(
|
|
||||||
# len(packet), self.total_bytes, len(messages), self.total_messages, self.total_connections
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
|
|
||||||
if len(self.pending_acks) >= self.ACKS_THRESHOLD:
|
if len(self.pending_acks) >= self.ACKS_THRESHOLD:
|
||||||
log.info("Send {} acks".format(len(self.pending_acks)))
|
log.info("Send {} acks".format(len(self.pending_acks)))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user