]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi: update pending list when removing handle
authorejanchivdorj <ejanchivdorj@tableau.com>
Tue, 9 Mar 2021 21:23:43 +0000 (13:23 -0800)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 10 Mar 2021 13:05:02 +0000 (14:05 +0100)
when removing a handle, most of the lists are updated but pending list
is not updated. Updating now.

Closes #6713

lib/multi.c

index d3b670c314f25b8be54642701bf51296ebfcd304..f5bacc17cba164949c95dbc62a608bfdf15be4fc 100644 (file)
@@ -824,6 +824,17 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
     }
   }
 
+  /* Remove from the pending list if it is there. Otherwise this will
+     remain on the pending list forever due to the state change. */
+  for(e = multi->pending.head; e; e = e->next) {
+    struct Curl_easy *curr_data = e->ptr;
+
+    if(curr_data == data) {
+      Curl_llist_remove(&multi->pending, e, NULL);
+      break;
+    }
+  }
+
   /* make the previous node point to our next */
   if(data->prev)
     data->prev->next = data->next;
@@ -840,6 +851,8 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
      We do not touch the easy handle here! */
   multi->num_easy--; /* one less to care about now */
 
+  process_pending_handles(multi);
+
   Curl_update_timer(multi);
   return CURLM_OK;
 }