Assert that dispatched updates are Updates

This commit is contained in:
Lonami Exo 2019-06-15 21:15:57 +02:00
parent 5877459907
commit 40d32cee95

View File

@ -543,6 +543,13 @@ class MTProtoSender:
await self._process_message(message)
async def _handle_update(self, message):
try:
assert message.obj.SUBCLASS_OF_ID == 0x8af52aac # crc32(b'Updates')
except AssertionError:
self._log.warning('Note: %s is not an update, not dispatching it %s', message.obj)
return
print(message.obj.__class__.__name__)
self._log.debug('Handling update %s', message.obj.__class__.__name__)
if self._update_callback:
self._update_callback(message.obj)