summaryrefslogtreecommitdiff
path: root/http-fetch.c
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2007-09-11 03:02:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-09-19 10:22:29 (GMT)
commit45c1741235a1fbd54484fa1c67ea68569dcfa23e (patch)
treed8dc5c7ce6f1bd70c86346a2a54d7c087bb8124c /http-fetch.c
parent077d6f72c7db84d2b6b3db879e3d68ab60482d43 (diff)
downloadgit-45c1741235a1fbd54484fa1c67ea68569dcfa23e.zip
git-45c1741235a1fbd54484fa1c67ea68569dcfa23e.tar.gz
git-45c1741235a1fbd54484fa1c67ea68569dcfa23e.tar.bz2
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.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/http-fetch.c b/http-fetch.c
index 202fae0..e9b9f30 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