cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problem with reusing persistent connections

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 11 Sep 2007 11:37:02 -0700

On Tue, Sep 11, 2007 at 07:38:49PM +0200, Stefan Krause wrote:
> Questions:
> 1) According to my understanding I need a way to renew the connections from
> my multi and/or the contained easy handles when the physical data
> connection
> of the mobile phone has been re-established? HTTP transfers are
> segmented.
> That means that the physical data connection can be shut down and
> re-established during an ongoing transfer. The use case for that might be
> a high prio voice call which needs the mobile phone, the HTTP transfer
> will then be interrupted and continued after the data connection has been
> re-established.

If you reestablish the data connection and you get a new IP address, then
there's no way to "reuse" the existing connection and continue the HTTP
transfer because the existing connection is lost and the transfer is aborted.
You would need to run Mobile IP for this to work.

> 2) What is the right way to trigger renewal of the connections ?
> a) Should the Client-App inform somehow libCurl to renew the connections?
> How is that possible? OR

The CURLOPT_FORBID_REUSE should work well if you're only doing one transfer
between the times when the physical connection goes down, otherwise, it
does mean extra overhead. You can also call curl_easy_cleanup to
close any existing connections on demand. Unfortunately, I don't believe
libcurl currently will reuse an existing SSL context across connections.

> b) Should the closing of the physical data connection force the sockets
> which
> are currently in use by libCurl being closed. So that libCurl
> establishes
> a new connection?

There's no reliable way for libcurl to tell if the "physical connection" has
gone down. In the Mobile IP case, even that wouldn't be grounds enough
to close the sockets.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2007-09-11