git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Ludvig <michal@logix.cz>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Goo GGooo <googgooo@gmail.com>,
	git@vger.kernel.org, Junio C Hamano <junkio@cox.net>
Subject: Re: 2.6.17-rc6-mm2
Date: Tue, 20 Jun 2006 15:01:26 +1200	[thread overview]
Message-ID: <44976506.8040205@logix.cz> (raw)
In-Reply-To: <Pine.LNX.4.64.0606152335130.5498@g5.osdl.org>

[-- Attachment #1: Type: text/plain, Size: 1008 bytes --]

Linus Torvalds wrote:
> 
> On Fri, 16 Jun 2006, Goo GGooo wrote:
> 
>> I suggest adding SO_KEEPALIVE option on the git socket.
> 
> Actually, the really irritating thing is that we actually generate all 
> these nice status updates, which just makes pulling and cloning a lot more 
> comfortable, because you actually see what is going on, and what to 
> expect. 
> 
> Except they only work over ssh, where we have a separate channel (for 
> stderr), and with the native git protocol all that nice status work just 
> gets flushed to /dev/null :(

OpenBSD has CVS access to their repos over SSH even for anonymous users.
Could something similar be set up on git.kernel.org as well?

> And in your case, the usability downside actually turned into a real 
> accessibility bug.

Same issue here. Thanks for the hint. Attached is a patch against git
1.4.0 that solves it perfectly in my case.

Sysctl settings (for keepalive every 10 sec):
net.ipv4.tcp_keepalive_intvl=10
net.ipv4.tcp_keepalive_time=10

Michal

[-- Attachment #2: keepalive.diff --]
[-- Type: text/x-patch, Size: 1375 bytes --]

Set SO_KEEPALIVE option on native git:// sockets.

Signed-off-by: Michal Ludvig <michal@logix.cz>

Index: git-1.4.0/connect.c
===================================================================
--- git-1.4.0.orig/connect.c
+++ git-1.4.0/connect.c
@@ -331,7 +331,7 @@ static int git_tcp_connect_sock(char *ho
 	char *colon, *end;
 	char *port = STR(DEFAULT_GIT_PORT);
 	struct addrinfo hints, *ai0, *ai;
-	int gai;
+	int gai, option;
 
 	if (host[0] == '[') {
 		end = strchr(host + 1, ']');
@@ -363,6 +363,10 @@ static int git_tcp_connect_sock(char *ho
 				ai->ai_socktype, ai->ai_protocol);
 		if (sockfd < 0)
 			continue;
+
+		option = 1;
+		setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &option, sizeof(option));
+
 		if (connect(sockfd, ai->ai_addr, ai->ai_addrlen) < 0) {
 			close(sockfd);
 			sockfd = -1;
@@ -392,7 +396,7 @@ static int git_tcp_connect_sock(char *ho
 	struct hostent *he;
 	struct sockaddr_in sa;
 	char **ap;
-	unsigned int nport;
+	unsigned int nport, option;
 
 	if (host[0] == '[') {
 		end = strchr(host + 1, ']');
@@ -433,6 +437,9 @@ static int git_tcp_connect_sock(char *ho
 		sa.sin_port = htons(nport);
 		memcpy(&sa.sin_addr, *ap, he->h_length);
 
+		option = 1;
+		setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &option, sizeof(option));
+
 		if (connect(sockfd, (struct sockaddr *)&sa, sizeof sa) < 0) {
 			close(sockfd);
 			sockfd = -1;

  parent reply	other threads:[~2006-06-20  3:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ef5305790606142040r5912ce58kf9f889c3d61b2cc0@mail.gmail.com>
2006-06-16  1:14 ` 2.6.17-rc6-mm2 Goo GGooo
2006-06-16  2:46   ` 2.6.17-rc6-mm2 Linus Torvalds
2006-06-16  5:49     ` 2.6.17-rc6-mm2 Goo GGooo
2006-06-16  6:39       ` 2.6.17-rc6-mm2 Linus Torvalds
2006-06-16 20:56         ` 2.6.17-rc6-mm2 H. Peter Anvin
2006-06-16 22:52           ` 2.6.17-rc6-mm2 Junio C Hamano
2006-06-17  0:22           ` 2.6.17-rc6-mm2 Linus Torvalds
2006-06-16 22:44         ` 2.6.17-rc6-mm2 bert hubert
2006-06-20  3:01         ` Michal Ludvig [this message]
2006-06-20  3:22           ` 2.6.17-rc6-mm2 Linus Torvalds
2006-06-16 12:40       ` 2.6.17-rc6-mm2 Uwe Zeisberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44976506.8040205@logix.cz \
    --to=michal@logix.cz \
    --cc=git@vger.kernel.org \
    --cc=googgooo@gmail.com \
    --cc=junkio@cox.net \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).