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-push.c | |
parent | 077d6f72c7db84d2b6b3db879e3d68ab60482d43 (diff) | |
download | git-45c1741235a1fbd54484fa1c67ea68569dcfa23e.tar.gz git-45c1741235a1fbd54484fa1c67ea68569dcfa23e.tar.xz |
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-push.c')
-rw-r--r-- | http-push.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/http-push.c b/http-push.c index 7c3720f60..c7471fa11 100644 --- a/http-push.c +++ b/http-push.c @@ -795,38 +795,27 @@ static void finish_request(struct transfer_request *request) } #ifdef USE_CURL_MULTI -void fill_active_slots(void) +int fill_active_slot(void) { struct transfer_request *request = request_queue_head; - struct transfer_request *next; - struct active_request_slot *slot = active_queue_head; - int num_transfers; if (aborted) - return; + return 0; - while (active_requests < max_requests && request != NULL) { - next = request->next; + for (request = request_queue_head; request; request = request->next) { if (request->state == NEED_FETCH) { start_fetch_loose(request); + return 1; } else if (pushing && request->state == NEED_PUSH) { if (remote_dir_exists[request->obj->sha1[0]] == 1) { start_put(request); } else { start_mkcol(request); } - curl_multi_perform(curlm, &num_transfers); - } - request = 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 |