Handle receiving errors

This commit is contained in:
Lonami Exo
2018-10-02 08:55:46 +02:00
parent cf7e5d5592
commit bc1fd9039d
3 changed files with 47 additions and 12 deletions

View File

@@ -120,6 +120,7 @@ class MTProtoState:
else:
raise BufferError("Can't decode packet ({})".format(body))
# TODO Check salt, session_id and sequence_number
key_id = struct.unpack('<Q', body[:8])[0]
if key_id != self.auth_key.key_id:
raise SecurityError('Server replied with an invalid auth key')