Remove socket fd from the loop reader upon closing

This commit is contained in:
Lonami Exo 2018-06-17 15:48:26 +02:00
parent aaa7ec757b
commit 145d4b7105

View File

@ -107,6 +107,7 @@ class TcpClient:
def close(self):
"""Closes the connection."""
fd = self._socket.fileno()
try:
if self._socket is not None:
if self.is_connected:
@ -117,6 +118,8 @@ class TcpClient:
finally:
self._socket = None
self._closed.set()
if fd:
self._loop.remove_reader(fd)
async def _wait_timeout_or_close(self, coro):
"""