cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: multi->num_alive

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 25 Aug 2006 09:02:55 +0200 (CEST)

On Thu, 24 Aug 2006, Armel Asselin wrote:

> the number of 'alive' easy in the multi handle seems not to be decreased
> when a easy without any problem is removed before completion from the
> multi-handle (for example when canceled by the user), the count of easy
> handle is well decremented, but not 'num_alive'.

Ah, you're right! This bug was introduced when I changed the way we keep
track of the number of "alive" connections... Can you please check if this
patch solves the problem for you:

--- lib/multi.c 4 Aug 2006 14:39:19 -0000 1.96
+++ lib/multi.c 25 Aug 2006 07:01:52 -0000
@@ -386,6 +386,10 @@
    if(easy) {
      /* If the 'state' is not INIT or COMPLETED, we might need to do something
         nice to put the easy_handle in a good known state when this returns.
*/
+ if(easy->state != CURLM_STATE_COMPLETED)
+ /* this handle is "alive" so we need to count down the total number of
+ alive connections when this is removed */
+ multi->num_alive--;

      /* The timer must be shut down before easy->multi is set to NULL,
         else the timenode will remain in the splay tree after

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-08-25