Merge branch 'LonamiWebs:v1' into main

This commit is contained in:
Darskiy 2025-04-18 15:46:29 +03:00 committed by GitHub
commit c5651e1e16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -152,7 +152,7 @@ class MTProtoState:
""" """
Inverse of `encrypt_message_data` for incoming server messages. Inverse of `encrypt_message_data` for incoming server messages.
""" """
now = time.time() + self.time_offset # get the time as early as possible, even if other checks make it go unused now = time.time() # get the time as early as possible, even if other checks make it go unused
if len(body) < 8: if len(body) < 8:
raise InvalidBufferError(body) raise InvalidBufferError(body)
@ -204,8 +204,14 @@ class MTProtoState:
# #
# This means we skip the time check for certain types of messages. # This means we skip the time check for certain types of messages.
if obj.CONSTRUCTOR_ID not in (BadServerSalt.CONSTRUCTOR_ID, BadMsgNotification.CONSTRUCTOR_ID): if obj.CONSTRUCTOR_ID not in (BadServerSalt.CONSTRUCTOR_ID, BadMsgNotification.CONSTRUCTOR_ID):
if not self._highest_remote_id and not self.time_offset:
# If the first message we receive is a bad notification, take this opportunity
# to adjust the time offset. Assume it will remain stable afterwards. Updating
# the offset unconditionally would make the next checks pointless.
self.update_time_offset(remote_msg_id)
remote_msg_time = remote_msg_id >> 32 remote_msg_time = remote_msg_id >> 32
time_delta = now - remote_msg_time time_delta = (now + self.time_offset) - remote_msg_time
if time_delta > MSG_TOO_OLD_DELTA: if time_delta > MSG_TOO_OLD_DELTA:
self._log.warning('Server sent a very old message with ID %d, ignoring (see FAQ for details)', remote_msg_id) self._log.warning('Server sent a very old message with ID %d, ignoring (see FAQ for details)', remote_msg_id)

View File

@ -901,6 +901,7 @@ phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason;
phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason; phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason;
phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason; phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason;
phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason; phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason;
phoneCallDiscardReasonAllowGroupCall#afe2b839 encrypted_key:bytes = PhoneCallDiscardReason;
dataJSON#7d748d04 data:string = DataJSON; dataJSON#7d748d04 data:string = DataJSON;