cURL / Mailing Lists / curl-library / Single Mail


Re: curl_multi_perform usage & easy handle "reset"

From: Davide Pippa <>
Date: Sat, 11 Aug 2007 12:00:08 +0200

>> Then I suppose reusing an easy handle with multi interfare involves
>> removing it after transfer has finished and adding it again to begin a
>> new transfer?
>Is is not explained explicitly, but this is what we discovered in
>and are doing that for a while. Remove is effective, whereas even
>without removal is not helpful.
>My guess, that this is more a bug, than a feature ...
>We planned to explore it, but only improved the removal to be fast (in
>7.16.2), and
>always more urgent issues were coming.
>It may be related to states and initialization. If you have some time to
>explore it,
>fix it, propose re-use API, it would be very much appreciated.

I'm a libcurl beginner, browsing the code I see that:
- curl_multi_add_handle() resets the state to CURLM_STATE_INIT;
- curl_multi_remove_handle() does not touch the state;

So the needed operation is to reset the state to CURLM_STATE_INIT;
In lib/multi.c at line 1358 (where state CURLM_STATE_COMPLETED is managed)
there is a comment that reads:

      /* This node should be delinked from the list now and we should post
         an information message that we are complete. */

Then it seems to me the remove/add path is currently the one libcurl supports...
(or that an automatic removal is on the TODO list?) but I'm not too
qualified to say that :)

The only API improvement I would propose could be a function that changes
the multi state from the blocking states (CURLM_STATE_COMPLETED or
various initializations; a sort of fusion of remove/add functions without the
linked list management.
Received on 2007-08-11