Merge "Modify connection timeout process"

This commit is contained in:
Zuul 2021-03-10 19:05:27 +00:00 committed by Gerrit Code Review
commit 3f6fa2da29
1 changed files with 12 additions and 9 deletions

View File

@ -1250,15 +1250,18 @@ class BaseClient(BaseClientServer):
start_time = time.time()
while self.running:
self.connections_condition.acquire()
while self.running and not self.active_connections:
if timeout is not None:
self._checkTimeout(start_time, timeout)
self.log.debug("Waiting for at least one active connection")
self.connections_condition.wait(timeout=1)
if self.active_connections:
self.log.debug("Active connection found")
connected = True
self.connections_condition.release()
try:
while self.running and not self.active_connections:
if timeout is not None:
self._checkTimeout(start_time, timeout)
self.log.debug("Waiting for at least one active "
"connection")
self.connections_condition.wait(timeout=1)
if self.active_connections:
self.log.debug("Active connection found")
connected = True
finally:
self.connections_condition.release()
if connected:
return