@@ -57,10 +57,12 @@ async def _init_socks5_connection(
5757 )
5858 conn .send (socksio .socks5 .SOCKS5AuthMethodsRequest ([auth_method ]))
5959 outgoing_bytes = conn .data_to_send ()
60- await stream .write (outgoing_bytes , timeout = timeout ) # <--- FIX 2: Pass timeout
60+ await stream .write (outgoing_bytes , timeout = timeout ) # <--- FIX 2: Pass timeout
6161
6262 # Auth method response
63- incoming_bytes = await stream .read (max_bytes = 4096 , timeout = timeout ) # <--- FIX 3: Pass timeout
63+ incoming_bytes = await stream .read (
64+ max_bytes = 4096 , timeout = timeout
65+ ) # <--- FIX 3: Pass timeout
6466 response = conn .receive_data (incoming_bytes )
6567 assert isinstance (response , socksio .socks5 .SOCKS5AuthReply )
6668 if response .method != auth_method :
@@ -76,10 +78,12 @@ async def _init_socks5_connection(
7678 username , password = auth
7779 conn .send (socksio .socks5 .SOCKS5UsernamePasswordRequest (username , password ))
7880 outgoing_bytes = conn .data_to_send ()
79- await stream .write (outgoing_bytes , timeout = timeout ) # <--- FIX 4: Pass timeout
81+ await stream .write (outgoing_bytes , timeout = timeout ) # <--- FIX 4: Pass timeout
8082
8183 # Username/password response
82- incoming_bytes = await stream .read (max_bytes = 4096 , timeout = timeout ) # <--- FIX 5: Pass timeout
84+ incoming_bytes = await stream .read (
85+ max_bytes = 4096 , timeout = timeout
86+ ) # <--- FIX 5: Pass timeout
8387 response = conn .receive_data (incoming_bytes )
8488 assert isinstance (response , socksio .socks5 .SOCKS5UsernamePasswordReply )
8589 if not response .success :
@@ -92,10 +96,12 @@ async def _init_socks5_connection(
9296 )
9397 )
9498 outgoing_bytes = conn .data_to_send ()
95- await stream .write (outgoing_bytes , timeout = timeout ) # <--- FIX 6: Pass timeout
99+ await stream .write (outgoing_bytes , timeout = timeout ) # <--- FIX 6: Pass timeout
96100
97101 # Connect response
98- incoming_bytes = await stream .read (max_bytes = 4096 , timeout = timeout ) # <--- FIX 7: Pass timeout
102+ incoming_bytes = await stream .read (
103+ max_bytes = 4096 , timeout = timeout
104+ ) # <--- FIX 7: Pass timeout
99105 response = conn .receive_data (incoming_bytes )
100106 assert isinstance (response , socksio .socks5 .SOCKS5Reply )
101107 if response .reply_code != socksio .socks5 .SOCKS5ReplyCode .SUCCEEDED :
@@ -211,7 +217,7 @@ async def handle_async_request(self, request: Request) -> Response:
211217 "host" : self ._remote_origin .host .decode ("ascii" ),
212218 "port" : self ._remote_origin .port ,
213219 "auth" : self ._proxy_auth ,
214- "timeout" : timeout , # <--- FIX 8: Pass timeout argument
220+ "timeout" : timeout , # <--- FIX 8: Pass timeout argument
215221 }
216222 async with Trace (
217223 "setup_socks5_connection" , logger , request , kwargs
@@ -313,4 +319,4 @@ def info(self) -> str:
313319 return self ._connection .info ()
314320
315321 def __repr__ (self ) -> str :
316- return f"<{ self .__class__ .__name__ } [{ self .info ()} ]>"
322+ return f"<{ self .__class__ .__name__ } [{ self .info ()} ]>"
0 commit comments