Ignore bad file descriptor while closing

This commit is contained in:
Lonami Exo 2018-03-02 17:26:42 +01:00
parent 4c7224e56a
commit a7f98fd3cc

View File

@ -168,7 +168,10 @@ class TcpClient:
__log__.info('ConnectionError "%s" while reading data', e)
self._raise_connection_reset(e)
except OSError as e:
__log__.info('OSError "%s" while reading data', e)
if e.errno != errno.EBADF and self._closing_lock.locked():
# Ignore bad file descriptor while closing
__log__.info('OSError "%s" while reading data', e)
if e.errno in CONN_RESET_ERRNOS:
self._raise_connection_reset(e)
else: