Fix BrokenPipeError was instance of OSError

This commit is contained in:
Lonami Exo 2017-09-22 13:51:11 +02:00
parent 4a8e5c865a
commit 9dfb5d493c

View File

@ -90,13 +90,13 @@ class TcpClient:
self._socket.sendall(data)
except socket.timeout as e:
raise TimeoutError() from e
except BrokenPipeError:
self._raise_connection_reset()
except OSError as e:
if e.errno == errno.EBADF:
self._raise_connection_reset()
else:
raise
except BrokenPipeError:
self._raise_connection_reset()
def read(self, size):
"""Reads (receives) a whole block of 'size bytes