mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-04 05:34:41 +03:00
Remove socket fd from the loop reader upon closing
This commit is contained in:
parent
aaa7ec757b
commit
145d4b7105
|
@ -107,6 +107,7 @@ class TcpClient:
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""Closes the connection."""
|
"""Closes the connection."""
|
||||||
|
fd = self._socket.fileno()
|
||||||
try:
|
try:
|
||||||
if self._socket is not None:
|
if self._socket is not None:
|
||||||
if self.is_connected:
|
if self.is_connected:
|
||||||
|
@ -117,6 +118,8 @@ class TcpClient:
|
||||||
finally:
|
finally:
|
||||||
self._socket = None
|
self._socket = None
|
||||||
self._closed.set()
|
self._closed.set()
|
||||||
|
if fd:
|
||||||
|
self._loop.remove_reader(fd)
|
||||||
|
|
||||||
async def _wait_timeout_or_close(self, coro):
|
async def _wait_timeout_or_close(self, coro):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user