[PATCH] connect: display connection progress
From: Michael S. Tsirkin <hidden>
Date: 2016-06-15 22:43:08
Make git notify the user about host resolution/connection attempts. This is useful both as a progress indicator on slow links, and helps reassure the user there are no DNS/firewall problems. Signed-off-by: Michael S. Tsirkin <redacted> --- I find the following useful. This currently only covers native git protocol. I expect it would be easy to extend this to other protocols, if there's interest. Opinions?
diff --git a/connect.c b/connect.c
index da89c9c..f026713 100644
--- a/connect.c
+++ b/connect.c@@ -425,9 +425,11 @@ static int git_tcp_connect_sock(char *host) hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; + fprintf(stderr, "Looking up %s ... ", host); gai = getaddrinfo(host, port, &hints, &ai); if (gai) die("Unable to look up %s (port %s) (%s)", host, port, gai_strerror(gai)); + fprintf(stderr, "done.\nConnecting to %s (port %s) ... ", host, port); for (ai0 = ai; ai; ai = ai->ai_next) { sockfd = socket(ai->ai_family,
@@ -450,6 +452,8 @@ static int git_tcp_connect_sock(char *host) if (sockfd < 0) die("unable to connect a socket (%s)", strerror(saved_errno)); + fprintf(stderr, "done.\n"); + return sockfd; }
--
MST