@@ -171,7 +171,9 @@ async def check_server_alive(interval, rserver, verbose):
171
171
if remote .direct :
172
172
continue
173
173
try :
174
- _ , writer = await remote .open_connection (None , None , None , None )
174
+ _ , writer = await remote .open_connection (None , None , None , None , timeout = 3 )
175
+ except asyncio .CancelledError as ex :
176
+ return
175
177
except Exception as ex :
176
178
if remote .alive :
177
179
verbose (f'{ remote .rproto .name } { remote .bind } -> OFFLINE' )
@@ -315,7 +317,7 @@ def connection_made(prot, transport):
315
317
def datagram_received (prot , data , addr ):
316
318
asyncio .ensure_future (datagram_handler (prot .transport , data , addr , ** vars (self ), ** args ))
317
319
return asyncio .get_event_loop ().create_datagram_endpoint (Protocol , local_addr = (self .host_name , self .port ))
318
- async def open_connection (self , host , port , local_addr , lbind ):
320
+ async def open_connection (self , host , port , local_addr , lbind , timeout = SOCKET_TIMEOUT ):
319
321
if self .reuse or self .ssh :
320
322
if self .streams is None or self .streams .done () and (self .reuse and not self .handler ):
321
323
self .streams = asyncio .get_event_loop ().create_future ()
@@ -354,7 +356,7 @@ async def open_connection(self, host, port, local_addr, lbind):
354
356
wait = asyncio .open_unix_connection (path = self .bind , ssl = self .sslclient , server_hostname = '' if self .sslclient else None )
355
357
else :
356
358
wait = asyncio .open_connection (host = self .host_name , port = self .port , ssl = self .sslclient , local_addr = local_addr , family = family )
357
- reader , writer = await asyncio .wait_for (wait , timeout = SOCKET_TIMEOUT )
359
+ reader , writer = await asyncio .wait_for (wait , timeout = timeout )
358
360
except Exception as ex :
359
361
if self .reuse :
360
362
self .streams .set_exception (ex )
0 commit comments