mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-21 21:39:46 +03:00
More logging for bad messages (#907)
This commit is contained in:
parent
b3990546eb
commit
7729a2a78f
|
@ -611,7 +611,7 @@ class MTProtoSender:
|
||||||
bad_msg = message.obj
|
bad_msg = message.obj
|
||||||
msg = self._pending_messages.get(bad_msg.bad_msg_id)
|
msg = self._pending_messages.get(bad_msg.bad_msg_id)
|
||||||
|
|
||||||
__log__.debug('Handling bad msg for message %d', bad_msg.bad_msg_id)
|
__log__.debug('Handling bad msg %s', bad_msg)
|
||||||
if bad_msg.error_code in (16, 17):
|
if bad_msg.error_code in (16, 17):
|
||||||
# Sent msg_id too low or too high (respectively).
|
# Sent msg_id too low or too high (respectively).
|
||||||
# Use the current msg_id to determine the right time offset.
|
# Use the current msg_id to determine the right time offset.
|
||||||
|
|
|
@ -157,10 +157,20 @@ class MTProtoState:
|
||||||
Updates the time offset to the correct
|
Updates the time offset to the correct
|
||||||
one given a known valid message ID.
|
one given a known valid message ID.
|
||||||
"""
|
"""
|
||||||
|
bad = self._get_new_msg_id()
|
||||||
|
old = self.time_offset
|
||||||
|
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
correct = correct_msg_id >> 32
|
correct = correct_msg_id >> 32
|
||||||
self.time_offset = correct - now
|
self.time_offset = correct - now
|
||||||
|
|
||||||
|
if self.time_offset != old:
|
||||||
self._last_msg_id = 0
|
self._last_msg_id = 0
|
||||||
|
__log__.debug(
|
||||||
|
'Updated time offset (old offset %d, bad %d, good %d, new %d)',
|
||||||
|
old, bad, correct_msg_id, self.time_offset
|
||||||
|
)
|
||||||
|
|
||||||
return self.time_offset
|
return self.time_offset
|
||||||
|
|
||||||
def _get_seq_no(self, content_related):
|
def _get_seq_no(self, content_related):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user