cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: FTP keep alive connection

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 4 Jan 2008 22:54:29 +0100 (CET)

On Fri, 4 Jan 2008, Yang Tse wrote:

> I don't know how this should properly be fixed, so if someone else can help
> with this it would be nice.
>
> Right now we have this code effective in the curl tool:
>
> http://cool.haxx.se/cvs.cgi/curl/src/main.c.diff?r1=1.435&r2=1.437
>
> And it is causing some trouble on the TFTP tests. Specifically at least on
> cygwin and on AIX 5.1 autobuilds.
>
> The problem is that SO_KEEPALIVE is not supported by the underlying
> protocol. This makes connection attempt using curl to fail when trying to
> verify the tftpd server in the test harness.

Yeah, it is indeed silly to (attempt to) do keep-alives on UDP streams...! :-O

> My hack at fixing this would be the attached patch. But I'm feeling that
> there might be better options to fix this.

I would say that the only way to do this any better is to provide more info
from libcurl in the callback as to what the connection is used for, or for
what protocol etc and that isn't likely to happen without breaking API/ABI so
at this point I believe your patch is good enough.

> After all. Wasn't the above mentioned diff only intended to keep open the
> ftp control connection for very long file transfers ? Isn't it right now
> affecting all protocols ?

Well yes it was mainly targetted for the FTP control connections but since
we've also had many questions in the past about other linger/idle connections
that never die, I thought it was just a conveniance to make it effective for
all (TCP) connections at once. Clearly I was (again) not thinking on the
details good enough!

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-01-04