mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-09 05:19:41 +00:00
Ensure the connection is flagged as closed on errors, move #201
This commit is contained in:
@@ -321,13 +321,9 @@ class TelegramClient(TelegramBareClient):
|
||||
|
||||
try:
|
||||
self(LogOutRequest())
|
||||
# The server may have already disconnected us, we still
|
||||
# try to disconnect to make sure.
|
||||
self.disconnect()
|
||||
except OSError as e:
|
||||
# macOS issue: https://github.com/veusz/veusz/issues/54
|
||||
# Socket has been already closed (Errno 57)
|
||||
# Fail on any other error
|
||||
if e.errno != errno.ENOTCONN:
|
||||
raise
|
||||
except (RPCError, ConnectionError):
|
||||
# Something happened when logging out, restore the state back
|
||||
self._sender.logging_out = False
|
||||
|
Reference in New Issue
Block a user