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>

Eric Wong committed Sep 13, 2016 at 00:25 UTC 2abc848d5431d028b4a6c643c93c7e371e7fdc7e
1 file changed +6 -4
http.c
+6 -4
@@ -855,11 +855,13 @@ void run_active_slot(struct active_request_slot *slot)
855 static void release_active_slot(struct active_request_slot *slot)
856 {
857 closedown_active_slot(slot);
858 - if (slot->curl && curl_session_count > min_curl_sessions) {
858 + if (slot->curl) {
859 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 + }
865 }
866 #ifdef USE_CURL_MULTI
867 fill_active_slots();