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>
This commit is contained in:
Eric Wong 2016-09-13 00:25:57 +00:00 committed by Junio C Hamano
parent d8b6b84df0
commit 2abc848d54

10
http.c
View File

@ -855,11 +855,13 @@ void run_active_slot(struct active_request_slot *slot)
static void release_active_slot(struct active_request_slot *slot) static void release_active_slot(struct active_request_slot *slot)
{ {
closedown_active_slot(slot); closedown_active_slot(slot);
if (slot->curl && curl_session_count > min_curl_sessions) { if (slot->curl) {
xmulti_remove_handle(slot); xmulti_remove_handle(slot);
curl_easy_cleanup(slot->curl); if (curl_session_count > min_curl_sessions) {
slot->curl = NULL; curl_easy_cleanup(slot->curl);
curl_session_count--; slot->curl = NULL;
curl_session_count--;
}
} }
#ifdef USE_CURL_MULTI #ifdef USE_CURL_MULTI
fill_active_slots(); fill_active_slots();