mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-03 21:24:35 +03:00
Only reset auth_key on error -404
This error is "auth key not found", and the authorization key should probably not be reset on other error codes. This might address #1457.
This commit is contained in:
parent
185a93a105
commit
09f4c5c708
|
@ -373,12 +373,12 @@ class MTProtoSender:
|
|||
# TODO there should probably only be one place to except all these errors
|
||||
if isinstance(e, InvalidBufferError) and e.code == 404:
|
||||
self._log.info('Broken authorization key; resetting')
|
||||
self.auth_key.key = None
|
||||
if self._auth_key_callback:
|
||||
self._auth_key_callback(None)
|
||||
else:
|
||||
self._log.warning('Invalid buffer %s', e)
|
||||
|
||||
self.auth_key.key = None
|
||||
if self._auth_key_callback:
|
||||
self._auth_key_callback(None)
|
||||
except Exception as e:
|
||||
last_error = e
|
||||
self._log.exception('Unexpected exception reconnecting on '
|
||||
|
@ -497,13 +497,12 @@ class MTProtoSender:
|
|||
except BufferError as e:
|
||||
if isinstance(e, InvalidBufferError) and e.code == 404:
|
||||
self._log.info('Broken authorization key; resetting')
|
||||
self.auth_key.key = None
|
||||
if self._auth_key_callback:
|
||||
self._auth_key_callback(None)
|
||||
else:
|
||||
self._log.warning('Invalid buffer %s', e)
|
||||
|
||||
self.auth_key.key = None
|
||||
if self._auth_key_callback:
|
||||
self._auth_key_callback(None)
|
||||
|
||||
self._start_reconnect(e)
|
||||
return
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in New Issue
Block a user