cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH] always multi v5

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 15 Jan 2013 11:23:36 +0100 (CET)

On Mon, 14 Jan 2013, Yang Tse wrote:

> When trying to use this connection in multi.c:1430 with Curl_readwrite() it
> finds that the connection has already been disconnected. easy->result gets
> CURLE_RECV_ERROR in multi.c:1430 and 'done' is FALSE.

Thanks for that analysis. It brights much clarity!

The 'done' being FALSE is not good. If the retry is to be done, we must
consider that request as done so we need to explicitly make it so. Please try
the patch below and see if it makes anything better. It works fine for me with
the patch applied and I believe it is the right approach.

> And finally the big question. Do we really have to retry CURLM_STATE_PERFORM
> upon such conditions or should this be going to a previous state or aborting
> upon a given retry count or even at first failure?

Yes! It needs to change back to the CURLM_STATE_CONNECT state. That is what it
will (should) do if the request is done and a retry is scheduled.

There's no need for a retry count since the failed connection will get closed
in this procedure so it can't happen again on the same connection.

Here's the patch (made on top of v5):

--- a/lib/multi.c
+++ b/lib/multi.c
@@ -1450,9 +1450,12 @@ static CURLMcode multi_runsingle(struct Curl_multi
*multi
          if(!ret)
            retry = (newurl)?TRUE:FALSE;

- if(retry)
- /* if we are to retry, set the result to OK */
+ if(retry) {
+ /* if we are to retry, set the result to OK and consider the
+ request as done */
            easy->result = CURLE_OK;
+ done = TRUE;
+ }
        }

        if(easy->result) {

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-01-15