Skip to content

Commit 2abc848

Browse files
Eric Wonggitster
authored andcommitted
http: always remove curl easy from curlm session on release
We must call curl_multi_remove_handle when releasing the slot to prevent subsequent calls to curl_multi_add_handle from failing with CURLM_ADDED_ALREADY (in curl 7.32.1+; older versions returned CURLM_BAD_EASY_HANDLE) Signed-off-by: Eric Wong <e@80x24.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent d8b6b84 commit 2abc848

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

http.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,11 +855,13 @@ void run_active_slot(struct active_request_slot *slot)
855855
static void release_active_slot(struct active_request_slot *slot)
856856
{
857857
closedown_active_slot(slot);
858-
if (slot->curl && curl_session_count > min_curl_sessions) {
858+
if (slot->curl) {
859859
xmulti_remove_handle(slot);
860-
curl_easy_cleanup(slot->curl);
861-
slot->curl = NULL;
862-
curl_session_count--;
860+
if (curl_session_count > min_curl_sessions) {
861+
curl_easy_cleanup(slot->curl);
862+
slot->curl = NULL;
863+
curl_session_count--;
864+
}
863865
}
864866
#ifdef USE_CURL_MULTI
865867
fill_active_slots();

0 commit comments

Comments
 (0)