cURL / Mailing Lists / curl-library / Single Mail


Re: Curl_done() is broken for pipelined connections

From: Dmitry Kurochkin <>
Date: Mon, 28 Jan 2008 02:02:13 +0300

2008/1/28, Daniel Stenberg <>:
> On Sun, 27 Jan 2008, Dmitry Kurochkin wrote:
> > Can we just remove bits.done? What so bad happens if we call Curl_done()
> > multiple times for the same connection?
> Bad things will happen as you may see if you try - it frees and "unlocks"
> resources that it has held for the sake of the request and it must not do them
> twice.
> What about adding a counter so that each Curl_do() increases a counter and
> Curl_done() decreases it so that the actual cleanup act is only done once it
> reaches zero again which then should be the last action in a pipeline?

If server sends "Connection: close" we should close connection after
this response even if we have over requests in pipeline (and counter
is not zero). So I think we should do cleanup when counter is zero or
close bit set or reuse_forbid bit set.

And do we need the counter at all? Can we use send_pipe + recv_pipe
size instead? If it is zero, then no requests are using this
connection at the moment, so we can cleanup.


> --
> Commercial curl and libcurl Technical Support:
Received on 2008-01-28