From 8ba3e4bb96806be63e5004cc959e110819be6ebd Mon Sep 17 00:00:00 2001 From: rick <156548662+rpt0@users.noreply.github.com> Date: Mon, 11 Aug 2025 13:10:45 +0700 Subject: [PATCH] Update tcp.py --- pyrogram/connection/transport/tcp/tcp.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pyrogram/connection/transport/tcp/tcp.py b/pyrogram/connection/transport/tcp/tcp.py index 1848ba35..908353a6 100644 --- a/pyrogram/connection/transport/tcp/tcp.py +++ b/pyrogram/connection/transport/tcp/tcp.py @@ -91,10 +91,8 @@ class TCP: ) sock.settimeout(TCP.TIMEOUT) - await self.loop.sock_connect( - sock=sock, - address=destination - ) + # fix: Use run_in_executor for socks.socksocket + await self.loop.run_in_executor(None, sock.connect, destination) sock.setblocking(False) @@ -123,7 +121,7 @@ class TCP: async def connect(self, address: Tuple[str, int]) -> None: try: await asyncio.wait_for(self._connect(address), TCP.TIMEOUT) - except asyncio.TimeoutError: # Re-raise as TimeoutError. asyncio.TimeoutError is deprecated in 3.11 + except asyncio.TimeoutError: # re raise as TimeoutError. asyncio.TimeoutError is deprecated in 3.11 raise TimeoutError("Connection timed out") async def close(self) -> None: