Except ConnectionAbortedError on TcpClient

This commit is contained in:
Lonami Exo 2017-12-22 11:27:57 +01:00
parent 23ab70fc29
commit 992017ddf8

View File

@ -113,7 +113,7 @@ class TcpClient:
self._socket.sendall(data)
except socket.timeout as e:
raise TimeoutError() from e
except BrokenPipeError:
except (BrokenPipeError, ConnectionAbortedError):
self._raise_connection_reset()
except OSError as e:
if e.errno == errno.EBADF:
@ -139,6 +139,11 @@ 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.
self._raise_connection_reset()
except OSError as e:
if e.errno == errno.EBADF or e.errno == errno.ENOTSOCK:
self._raise_connection_reset()