Merge "[TRAIN-and-older] Properly close sockets" into stable/train

This commit is contained in:
Zuul 2020-08-01 04:06:02 +00:00 committed by Gerrit Code Review
commit 0e7c3ab43d
1 changed files with 3 additions and 1 deletions

View File

@ -178,12 +178,14 @@ def wait_for_ssh_port(host, timeout=ENABLE_SSH_ADMIN_SSH_PORT_TIMEOUT):
return
except socket.error:
try:
# close previous socket before creating a new one
sock.close()
sock = socket.socket(socket.AF_INET6)
sock.connect((host, 22))
sock.close()
return
except socket.error:
pass
sock.close()
time.sleep(1)