cURL / Mailing Lists / curl-library / Single Mail


Re: [PATCH 2/7] pipelining: Fix connection handling under timeouts.

From: Carlo Wood <>
Date: Mon, 17 Nov 2014 14:54:42 +0100

On Sun, 16 Nov 2014 22:46:07 +0100
Carlo Wood <> wrote:

> * Marked for [closure]: Disconnected with pending data
> * Closing connection 1
> ... closes the FRESH connection that was JUST made BEFORE
> actually sending any data over it!

The problem here is of course that when mstate was just
set to CURLM_STATE_DO but not processed yet (as is the case when we're
testing for timeouts), then no data has been sent.

Looking at the state machine (switch) for case CURLM_STATE_DO: it seems
to me that it is impossible to leave the state machine in the same
state and still be running (it can end with setting an error and
disconnect_conn). In that case we can still use mstate instead of a new
variable, but we simply have to look for mstate > CURLM_STATE_DO to
know if data was already sent.

Attached a new patch. I went ahead and also fixed this test in
curl_multi_remove_handle and then that whole function by removing the
silly pipeline test and fixing easy_owns_conn, as mentioned on IRC;
that part then fixes the correct closing of a connection when the user
calls curl_multi_remove_handle() before a transaction finished, which
is very much like the timeout.

Carlo Wood <>
Received on 2014-11-17