@@ -287,10 +287,12 @@ def _raise_connection_failure(address, error, msg_prefix=None):
287
287
raise AutoReconnect (msg )
288
288
289
289
if PY3 :
290
- def _cond_wait (condition , timeout , deadline ):
290
+ def _cond_wait (condition , deadline ):
291
+ timeout = deadline - _time () if deadline else None
291
292
return condition .wait (timeout )
292
293
else :
293
- def _cond_wait (condition , timeout , deadline ):
294
+ def _cond_wait (condition , deadline ):
295
+ timeout = deadline - _time () if deadline else None
294
296
condition .wait (timeout )
295
297
# Python 2.7 always returns False for wait(),
296
298
# manually check for a timeout.
@@ -1322,14 +1324,7 @@ def _get_socket(self, all_credentials):
1322
1324
with self ._max_connecting_cond :
1323
1325
while (self ._pending >= self ._max_connecting and
1324
1326
not self .sockets ):
1325
- if self .opts .wait_queue_timeout :
1326
- # TODO: What if timeout is <= zero here?
1327
- # timeout = max(deadline - _time(), .001)
1328
- timeout = deadline - _time ()
1329
- else :
1330
- timeout = None
1331
- if not _cond_wait (self ._max_connecting_cond ,
1332
- timeout , deadline ):
1327
+ if not _cond_wait (self ._max_connecting_cond , deadline ):
1333
1328
# timeout
1334
1329
emitted_event = True
1335
1330
self ._raise_wait_queue_timeout ()
0 commit comments