mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-17 10:36:37 +00: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
|
# TODO there should probably only be one place to except all these errors
|
||||||
if isinstance(e, InvalidBufferError) and e.code == 404:
|
if isinstance(e, InvalidBufferError) and e.code == 404:
|
||||||
self._log.info('Broken authorization key; resetting')
|
self._log.info('Broken authorization key; resetting')
|
||||||
|
self.auth_key.key = None
|
||||||
|
if self._auth_key_callback:
|
||||||
|
self._auth_key_callback(None)
|
||||||
else:
|
else:
|
||||||
self._log.warning('Invalid buffer %s', e)
|
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:
|
except Exception as e:
|
||||||
last_error = e
|
last_error = e
|
||||||
self._log.exception('Unexpected exception reconnecting on '
|
self._log.exception('Unexpected exception reconnecting on '
|
||||||
@ -497,13 +497,12 @@ class MTProtoSender:
|
|||||||
except BufferError as e:
|
except BufferError as e:
|
||||||
if isinstance(e, InvalidBufferError) and e.code == 404:
|
if isinstance(e, InvalidBufferError) and e.code == 404:
|
||||||
self._log.info('Broken authorization key; resetting')
|
self._log.info('Broken authorization key; resetting')
|
||||||
|
self.auth_key.key = None
|
||||||
|
if self._auth_key_callback:
|
||||||
|
self._auth_key_callback(None)
|
||||||
else:
|
else:
|
||||||
self._log.warning('Invalid buffer %s', e)
|
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)
|
self._start_reconnect(e)
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user