summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-09-13 00:25:57 +0000
committerJunio C Hamano <gitster@pobox.com>2016-09-13 13:34:04 -0700
commit2abc848d5431d028b4a6c643c93c7e371e7fdc7e (patch)
treefd322c408fc841f12b3b5e3bd8766c1e92c118f8
parentd8b6b84df024b4ce2c10d7e5c725da24dcb19ff6 (diff)
downloadgit-ew/http-do-not-forget-to-call-curl-multi-remove-handle.tar.gz
http: always remove curl easy from curlm session on releaseew/http-do-not-forget-to-call-curl-multi-remove-handle
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>
-rw-r--r--http.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/http.c b/http.c
index a24f0d132d..6a97783d0a 100644
--- a/http.c
+++ b/http.c
@@ -855,11 +855,13 @@ void run_active_slot(struct active_request_slot *slot)
static void release_active_slot(struct active_request_slot *slot)
{
closedown_active_slot(slot);
- if (slot->curl && curl_session_count > min_curl_sessions) {
+ if (slot->curl) {
xmulti_remove_handle(slot);
- curl_easy_cleanup(slot->curl);
- slot->curl = NULL;
- curl_session_count--;
+ if (curl_session_count > min_curl_sessions) {
+ curl_easy_cleanup(slot->curl);
+ slot->curl = NULL;
+ curl_session_count--;
+ }
}
#ifdef USE_CURL_MULTI
fill_active_slots();