mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Workaround proxy sockets not timing out properly
This commit is contained in:
parent
52effe19d5
commit
cf06939a55
1 changed files with 4 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ import asyncio
|
|||
import ipaddress
|
||||
import logging
|
||||
import socket
|
||||
|
||||
import socks
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
@ -58,6 +59,8 @@ class TCP:
|
|||
password=proxy.get("password", None)
|
||||
)
|
||||
|
||||
self.socket.settimeout(TCP.TIMEOUT)
|
||||
|
||||
log.info("Using proxy %s", hostname)
|
||||
else:
|
||||
self.socket = socket.socket(
|
||||
|
|
@ -65,7 +68,7 @@ class TCP:
|
|||
else socket.AF_INET
|
||||
)
|
||||
|
||||
self.socket.setblocking(False)
|
||||
self.socket.setblocking(False)
|
||||
|
||||
async def connect(self, address: tuple):
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue