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>
This commit is contained in:

committed by
Junio C Hamano

parent
077d6f72c7
commit
45c1741235
23
http-fetch.c
23
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);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
obj_req = obj_req->next;
|
||||
}
|
||||
|
||||
while (slot != NULL) {
|
||||
if (!slot->in_use && slot->curl != NULL) {
|
||||
curl_easy_cleanup(slot->curl);
|
||||
slot->curl = NULL;
|
||||
}
|
||||
slot = slot->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user