Skip to content

Commit 787c2ae

Browse files
committed
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
1 parent 31987c3 commit 787c2ae

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/multi.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,18 +504,22 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
504504
if(!data->multi)
505505
return CURLM_OK; /* it is already removed so let's say it is fine! */
506506

507-
508507
premature = (data->mstate < CURLM_STATE_COMPLETED) ? TRUE : FALSE;
509508
easy_owns_conn = (data->easy_conn && (data->easy_conn->data == easy)) ?
510509
TRUE : FALSE;
511510

512511
/* If the 'state' is not INIT or COMPLETED, we might need to do something
513512
nice to put the easy_handle in a good known state when this returns. */
514-
if(premature)
513+
if(premature) {
515514
/* this handle is "alive" so we need to count down the total number of
516515
alive connections when this is removed */
517516
multi->num_alive--;
518517

518+
/* When this handle gets removed, other handles may be able to get the
519+
connection */
520+
Curl_multi_process_pending_handles(multi);
521+
}
522+
519523
if(data->easy_conn &&
520524
data->mstate > CURLM_STATE_DO &&
521525
data->mstate < CURLM_STATE_COMPLETED) {

0 commit comments

Comments
 (0)