Skip to content

Commit

Permalink
Workaround msg_seqno too low/high (closes #95)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Sep 14, 2017
1 parent 151e162 commit 12a3987
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions telethon/network/mtproto_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,15 @@ def _handle_bad_msg_notification(self, msg_id, sequence, reader):
self._logger.debug('Read Bad Message error: ' + str(error))
self._logger.debug('Attempting to use the correct time offset.')
return True
elif error_code == 32:
# msg_seqno too low, so just pump it up by some "large" amount
# TODO A better fix would be to start with a new fresh session ID
self.session._sequence += 64
return True
elif error_code == 33:
# msg_seqno too high never seems to happen but just in case
self.session._sequence -= 16
return True
else:
raise error

Expand Down

0 comments on commit 12a3987

Please sign in to comment.