Re: [PATCH] http: enable keepalive on TCP sockets
- From
- Eric Wong <normalperson@yhbt.net>
- Date
- Oct 14, 2013, 23:38 UTC
- Message-ID
- <20131014233839.GA26323@dcvr.yhbt.net>
- In-Reply-To
- <20131014214035.GB7007@sigill.intra.peff.net>
Jeff King <peff@peff.net> wrote:
Show 27 quoted lines
> On Mon, Oct 14, 2013 at 05:27:39AM +0000, Eric Wong wrote: > > Daniel Stenberg <daniel@haxx.se> wrote: > > > On Sat, 12 Oct 2013, Eric Wong wrote: > > > > > > >This is a follow up to commit > > > >e47a8583a20256851e7fc882233e3bd5bf33dc6e (enable SO_KEEPALIVE for > > > >connected TCP sockets). > > > > > > Just keep in mind that TCP keep-alive is enabled in awkwardly many > > > different ways on different systems and this patch only supports one > > > of them. Feel free to take inspiration from libcurl's source code > > > for doing this. See: > > > > > > https://github.com/bagder/curl/blob/master/lib/connect.c#L108 > > > > Thanks. I think the Linux-specific TCP_KEEP* knobs are overkill for git. > > (since this is mainly for non-interactive users, I went at least a day > > before realizing the process was stuck on my machine). > > I cannot comment on the knobs for other OSes. > > I don't think we should get into having a big compatibility layer that > just reproduces what is in curl. > > But is there any reason not to use CURLOPT_TCP_KEEPALIVE when it is > available, falling back to CURLOPT_SOCKOPTFUNCTION, and then finally to > nothing? That lets people on modern curl benefit from curl's more > portable code, without punishing people on older versions.
I wanted it to work as older curl first (since I noticed this on an old server). But your patch on top of mine looks reasonable, thanks.