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-fetch.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-fetch.c')
-rw-r--r-- | http-fetch.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/http-fetch.c b/http-fetch.c index 202fae0ba8..e9b9f307f8 100644 --- a/http-fetch.c +++ b/http-fetch.c @@ -317,30 +317,21 @@ static void release_object_request(struct object_request *obj_req) } #ifdef USE_CURL_MULTI -void fill_active_slots(void) +int fill_active_slot(void) { - struct object_request *obj_req = object_queue_head; - struct active_request_slot *slot = active_queue_head; - int num_transfers; + struct object_request *obj_req; - while (active_requests < max_requests && obj_req != NULL) { + for (obj_req = object_queue_head; obj_req; obj_req = obj_req->next) { if (obj_req->state == WAITING) { if (has_sha1_file(obj_req->sha1)) obj_req->state = COMPLETE; - else + else { start_object_request(obj_req); - curl_multi_perform(curlm, &num_transfers); - } - obj_req = obj_req->next; - } - - while (slot != NULL) { - if (!slot->in_use && slot->curl != NULL) { - curl_easy_cleanup(slot->curl); - slot->curl = NULL; + return 1; + } } - slot = slot->next; } + return 0; } #endif |