diff options
author | Daniel Barkalow <barkalow@iabervon.org> | 2007-09-10 23:02:28 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-09-19 03:22:29 -0700 |
commit | 45c1741235a1fbd54484fa1c67ea68569dcfa23e (patch) | |
tree | d8dc5c7ce6f1bd70c86346a2a54d7c087bb8124c /http.c | |
parent | 077d6f72c7db84d2b6b3db879e3d68ab60482d43 (diff) | |
download | git-45c1741235a1fbd54484fa1c67ea68569dcfa23e.tar.gz |
Refactor http.h USE_CURL_MULTI fill_active_slots().
This removes all of the boilerplate and http-internal stuff from
fill_active_slots() and makes it easy to turn into a callback.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -372,6 +372,7 @@ int start_active_slot(struct active_request_slot *slot) { #ifdef USE_CURL_MULTI CURLMcode curlm_result = curl_multi_add_handle(curlm, slot->curl); + int num_transfers; if (curlm_result != CURLM_OK && curlm_result != CURLM_CALL_MULTI_PERFORM) { @@ -379,11 +380,34 @@ int start_active_slot(struct active_request_slot *slot) slot->in_use = 0; return 0; } + + /* + * We know there must be something to do, since we just added + * something. + */ + curl_multi_perform(curlm, &num_transfers); #endif return 1; } #ifdef USE_CURL_MULTI +void fill_active_slots(void) +{ + struct active_request_slot *slot = active_queue_head; + + while (active_requests < max_requests) + if (!fill_active_slot()) + break; + + while (slot != NULL) { + if (!slot->in_use && slot->curl != NULL) { + curl_easy_cleanup(slot->curl); + slot->curl = NULL; + } + slot = slot->next; + } +} + void step_active_slots(void) { int num_transfers; |