aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-03-29 23:48:32 +0200
committerDaniel Stenberg <daniel@haxx.se>2015-03-29 23:49:12 +0200
commit787c2ae91b1f172ce9fdd2b6613c6217c00a85b3 (patch)
tree4c034d419b40b6ea88a5e0e7ae189483744c4bf2 /lib
parent31987c340ec99ec3f1e5943acd9509f4e3bf6a71 (diff)
multi: remove_handle: move pending connections
If the handle removed from the multi handle happens to be the one "owning" the pipeline other transfers will be waiting indefinitely. Now we move such handles back to connect to have them race (again) for getting the connection and thus avoid hanging. Bug: http://curl.haxx.se/bug/view.cgi?id=1465 Reported-by: Jiri Dvorak
Diffstat (limited to 'lib')
-rw-r--r--lib/multi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 4dc7f632a..c30835c3f 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -504,18 +504,22 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
if(!data->multi)
return CURLM_OK; /* it is already removed so let's say it is fine! */
-
premature = (data->mstate < CURLM_STATE_COMPLETED) ? TRUE : FALSE;
easy_owns_conn = (data->easy_conn && (data->easy_conn->data == easy)) ?
TRUE : FALSE;
/* 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(premature)
+ if(premature) {
/* this handle is "alive" so we need to count down the total number of
alive connections when this is removed */
multi->num_alive--;
+ /* When this handle gets removed, other handles may be able to get the
+ connection */
+ Curl_multi_process_pending_handles(multi);
+ }
+
if(data->easy_conn &&
data->mstate > CURLM_STATE_DO &&
data->mstate < CURLM_STATE_COMPLETED) {