1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

multi: move on from STATE_DONE faster

Make sure we always return CURLM_CALL_MULTI_PERFORM when we reach
CURLM_STATE_DONE since the state is transient and it can very well
continue executing as there is nothing to wait for.

Bug: http://curl.haxx.se/mail/lib-2013-08/0211.html
Reported-by: Yi Huang
This commit is contained in:
Daniel Stenberg 2013-08-21 23:08:38 +02:00
parent fc99eaa5ae
commit 22adb46a32

View File

@ -1556,21 +1556,15 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
} }
case CURLM_STATE_DONE: case CURLM_STATE_DONE:
/* this state is highly transient, so run another loop after this */
result = CURLM_CALL_MULTI_PERFORM;
if(data->easy_conn) { if(data->easy_conn) {
/* Remove ourselves from the receive pipeline, if we are there. */ /* Remove ourselves from the receive pipeline, if we are there. */
Curl_removeHandleFromPipeline(data, Curl_removeHandleFromPipeline(data, data->easy_conn->recv_pipe);
data->easy_conn->recv_pipe);
/* Check if we can move pending requests to send pipe */ /* Check if we can move pending requests to send pipe */
Curl_multi_process_pending_handles(multi); Curl_multi_process_pending_handles(multi);
if(data->easy_conn->bits.stream_was_rewound) {
/* This request read past its response boundary so we quickly let
the other requests consume those bytes since there is no
guarantee that the socket will become active again */
result = CURLM_CALL_MULTI_PERFORM;
}
/* post-transfer command */ /* post-transfer command */
data->result = Curl_done(&data->easy_conn, CURLE_OK, FALSE); data->result = Curl_done(&data->easy_conn, CURLE_OK, FALSE);
/* /*
@ -1587,7 +1581,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
if(data->wildcard.state != CURLWC_DONE) { if(data->wildcard.state != CURLWC_DONE) {
/* if a wildcard is set and we are not ending -> lets start again /* if a wildcard is set and we are not ending -> lets start again
with CURLM_STATE_INIT */ with CURLM_STATE_INIT */
result = CURLM_CALL_MULTI_PERFORM;
multistate(data, CURLM_STATE_INIT); multistate(data, CURLM_STATE_INIT);
break; break;
} }
@ -1596,7 +1589,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
/* after we have DONE what we're supposed to do, go COMPLETED, and /* after we have DONE what we're supposed to do, go COMPLETED, and
it doesn't matter what the Curl_done() returned! */ it doesn't matter what the Curl_done() returned! */
multistate(data, CURLM_STATE_COMPLETED); multistate(data, CURLM_STATE_COMPLETED);
break; break;
case CURLM_STATE_COMPLETED: case CURLM_STATE_COMPLETED: