mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-24 00:04:14 +03:00
TcpClient: Catch ConnectionError instead of its particular cases
That can be more reliable, especially in the case of using PySocks.
This commit is contained in:
parent
992017ddf8
commit
4a2a64ce2f
|
@ -113,7 +113,7 @@ class TcpClient:
|
|||
self._socket.sendall(data)
|
||||
except socket.timeout as e:
|
||||
raise TimeoutError() from e
|
||||
except (BrokenPipeError, ConnectionAbortedError):
|
||||
except ConnectionError:
|
||||
self._raise_connection_reset()
|
||||
except OSError as e:
|
||||
if e.errno == errno.EBADF:
|
||||
|
@ -139,10 +139,7 @@ class TcpClient:
|
|||
partial = self._socket.recv(bytes_left)
|
||||
except socket.timeout as e:
|
||||
raise TimeoutError() from e
|
||||
except ConnectionAbortedError:
|
||||
# ConnectionAbortedError: [WinError 10053]
|
||||
# An established connection was aborted by
|
||||
# the software in your host machine.
|
||||
except ConnectionError:
|
||||
self._raise_connection_reset()
|
||||
except OSError as e:
|
||||
if e.errno == errno.EBADF or e.errno == errno.ENOTSOCK:
|
||||
|
|
Loading…
Reference in New Issue
Block a user