Fix connection to proxy

Fix the proxy bug.

Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
S!R X 2024-07-23 10:21:35 +03:30 committed by wulan17
parent b8028541c9
commit 921b593285
No known key found for this signature in database
GPG key ID: 737814D4B5FF0420

View file

@ -21,6 +21,7 @@ import asyncio
import ipaddress import ipaddress
import logging import logging
import socket import socket
from concurrent.futures import ThreadPoolExecutor
from typing import Tuple, Dict, TypedDict, Optional from typing import Tuple, Dict, TypedDict, Optional
import socks import socks
@ -91,10 +92,8 @@ class TCP:
) )
sock.settimeout(TCP.TIMEOUT) sock.settimeout(TCP.TIMEOUT)
await self.loop.sock_connect( with ThreadPoolExecutor() as executor:
sock=sock, await self.loop.run_in_executor(executor, sock.connect, destination)
address=destination
)
sock.setblocking(False) sock.setblocking(False)