mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 19:03:46 +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,
|
ReadCancelledError, FileMigrateError, PhoneMigrateError,
|
||||||
NetworkMigrateError, UserMigrateError, PhoneCodeEmptyError,
|
NetworkMigrateError, UserMigrateError, PhoneCodeEmptyError,
|
||||||
PhoneCodeExpiredError, PhoneCodeHashEmptyError,
|
PhoneCodeExpiredError, PhoneCodeHashEmptyError,
|
||||||
PhoneCodeInvalidError)
|
PhoneCodeInvalidError, InvalidChecksumError)
|
||||||
|
|
||||||
# For sending and receiving requests
|
# For sending and receiving requests
|
||||||
from .tl import MTProtoRequest, Session, JsonSession
|
from .tl import MTProtoRequest, Session, JsonSession
|
||||||
|
@ -817,6 +817,14 @@ class TelegramClient(TelegramBareClient):
|
||||||
except ReadCancelledError:
|
except ReadCancelledError:
|
||||||
self._logger.info('Receiving updates cancelled')
|
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:
|
except OSError:
|
||||||
self._logger.warning('OSError on updates thread, %s logging out',
|
self._logger.warning('OSError on updates thread, %s logging out',
|
||||||
'was' if self.sender.logging_out else 'was not')
|
'was' if self.sender.logging_out else 'was not')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user