From 05dc46b0e3c008f9f83a576e59c74fd17735dfa9 Mon Sep 17 00:00:00 2001 From: Timo Lotterbach Date: Fri, 15 Jul 2016 16:48:42 +0200 Subject: [PATCH] Repo: improve error detection for new ssh connections this check can only detect errors that happen within 1 sec after launching ssh. But this is typically enough to catch configuration issues like 'connection refused' or 'authentication failed'. Change-Id: I00b6f62d4c2889b1faa6c820e49a198554c92795 --- git_config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/git_config.py b/git_config.py index 0379181a..3fc56b68 100644 --- a/git_config.py +++ b/git_config.py @@ -464,9 +464,13 @@ def _open_ssh(host, port=None): % (host,port, str(e)), file=sys.stderr) return False + time.sleep(1) + ssh_died = (p.poll() is not None) + if ssh_died: + return False + _master_processes.append(p) _master_keys.add(key) - time.sleep(1) return True finally: _master_keys_lock.release()