mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 10:53:44 +03:00
Trigger reconnection on BrokenPipeError and InvalidChecksumError
This commit is contained in:
parent
92b4125b2b
commit
c304ee903f
|
@ -11,7 +11,7 @@ from .errors import (RPCError, UnauthorizedError, InvalidParameterError,
|
|||
ReadCancelledError, FileMigrateError, PhoneMigrateError,
|
||||
NetworkMigrateError, UserMigrateError, PhoneCodeEmptyError,
|
||||
PhoneCodeExpiredError, PhoneCodeHashEmptyError,
|
||||
PhoneCodeInvalidError)
|
||||
PhoneCodeInvalidError, InvalidChecksumError)
|
||||
|
||||
# For sending and receiving requests
|
||||
from .tl import MTProtoRequest, Session, JsonSession
|
||||
|
@ -817,6 +817,14 @@ class TelegramClient(TelegramBareClient):
|
|||
except ReadCancelledError:
|
||||
self._logger.info('Receiving updates cancelled')
|
||||
|
||||
except BrokenPipeError:
|
||||
self._logger.info('Tcp session is broken. Reconnecting...')
|
||||
self.reconnect()
|
||||
|
||||
except InvalidChecksumError:
|
||||
self._logger.info('MTProto session is broken. Reconnecting...')
|
||||
self.reconnect()
|
||||
|
||||
except OSError:
|
||||
self._logger.warning('OSError on updates thread, %s logging out',
|
||||
'was' if self.sender.logging_out else 'was not')
|
||||
|
|
Loading…
Reference in New Issue
Block a user