Fix time_offset not being used at all after BadMsgNotification

Telegram would refuse to reply any further unless the message ID
had the correct time (causing some behaviour like .connect()
never connecting, due to the first request being sent always
failing). The fix was to use time_offset when calculating the
message ID, while this was right, it wasn't in use.
This commit is contained in:
Lonami Exo 2018-01-23 11:39:43 +01:00
parent 32b92b32a7
commit 6c73538bd4

View File

@ -311,7 +311,7 @@ class Session:
now = time.time() now = time.time()
nanoseconds = int((now - int(now)) * 1e+9) nanoseconds = int((now - int(now)) * 1e+9)
# "message identifiers are divisible by 4" # "message identifiers are divisible by 4"
new_msg_id = (int(now) << 32) | (nanoseconds << 2) new_msg_id = ((int(now) + self.time_offset) << 32) | (nanoseconds << 2)
with self._msg_id_lock: with self._msg_id_lock:
if self._last_msg_id >= new_msg_id: if self._last_msg_id >= new_msg_id: