mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-03 11:40:11 +03:00
Memory leaks fix
This commit is contained in:
parent
91e5ef852a
commit
6cfb829e58
|
@ -96,17 +96,19 @@ class TcpClient:
|
|||
self._closed.set()
|
||||
|
||||
async def _wait_close(self, coro):
|
||||
done, _ = await asyncio.wait(
|
||||
done, running = await asyncio.wait(
|
||||
[coro, self._closed.wait()],
|
||||
timeout=self.timeout,
|
||||
return_when=asyncio.FIRST_COMPLETED,
|
||||
loop=self._loop
|
||||
)
|
||||
for r in running:
|
||||
r.cancel()
|
||||
if not self.connected:
|
||||
raise self.SocketClosed()
|
||||
if not done:
|
||||
raise TimeoutError()
|
||||
return await done.pop()
|
||||
return done.pop().result()
|
||||
|
||||
async def write(self, data):
|
||||
"""Writes (sends) the specified bytes to the connected peer"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user