cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: potential bug in multi_runsingle() in multi.c ?

From: 邓民文 <dengminwen_at_gmail.com>
Date: Thu, 19 Jun 2008 15:31:57 +0800

2008/6/19 Daniel Stenberg <daniel_at_haxx.se>:

> On Wed, 18 Jun 2008, ??? wrote:
>
> oh, my mistake. i not read the souce code carefully.
>> so, is below code do right ???
>>
>> in url.c
>>
>
> - bool dead = SocketIsDead(check->sock[FIRSTSOCKET]);
>> + bool dead = (!check->inuse) &&
>> SocketIsDead(check->sock[FIRSTSOCKET]);
>>
>
> Yes, I think either that or:
>
> bool dead = !pipelen && SocketIsDead(check->sock[FIRSTSOCKET]);

                         ~~~~~~ pipelen == 0 ??? it pipelen always == 0 here

i found that the above code may be wrong...because the code already check
the pipeLen==0. just as below.

      if(pipeLen == 0) {
        /* The check for a dead socket makes sense only if there
           are no handles in pipeline */
- bool dead = SocketIsDead(check->sock[FIRSTSOCKET]);
+ bool dead = (!check->inuse) &&
SocketIsDead(check->sock[FIRSTSOCKET]);
        if(dead) {

if you read my previous mail carefully, you can see that why here
pipeLen==0, but still check->inuse == TRUE. in short, why pipelen == 0 can
be explain below:

1. easyhandle A reach CURLM_STATE_PERFORM state, do
Curl_removeHandleFromPipeline to pipe P, then pipelen--, may be == 0.
2. easyhandle B call Curl_disconnect(), and free the pipe P.
3. easyhandle A reach CURLM_STATE_DONE state, do
Curl_removeHandleFromPipeline to pipe P again.

>
> Have you tried your application with your fix?
>
> --
>
> / daniel.haxx.se
>

-- 
dengminwen_at_gmail.com
Received on 2008-06-19