HTTP cleanup
Fix broken build when USE_CURL_MULTI is not defined, as noted by Becky Bruce. During cleanup, free header slist that was created during init, as noted by Junio. Signed-off-by: Nick Hengeveld <nickh@reactrix.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
efd0201684
commit
b3ca4e4ebb
@ -788,6 +788,7 @@ static void finish_request(struct transfer_request *request)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_CURL_MULTI
|
||||||
void fill_active_slots(void)
|
void fill_active_slots(void)
|
||||||
{
|
{
|
||||||
struct transfer_request *request = request_queue_head;
|
struct transfer_request *request = request_queue_head;
|
||||||
@ -821,6 +822,7 @@ void fill_active_slots(void)
|
|||||||
slot = slot->next;
|
slot = slot->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void get_remote_object_list(unsigned char parent);
|
static void get_remote_object_list(unsigned char parent);
|
||||||
|
|
||||||
@ -851,8 +853,10 @@ static void add_fetch_request(struct object *obj)
|
|||||||
request->next = request_queue_head;
|
request->next = request_queue_head;
|
||||||
request_queue_head = request;
|
request_queue_head = request;
|
||||||
|
|
||||||
|
#ifdef USE_CURL_MULTI
|
||||||
fill_active_slots();
|
fill_active_slots();
|
||||||
step_active_slots();
|
step_active_slots();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_send_request(struct object *obj, struct remote_lock *lock)
|
static int add_send_request(struct object *obj, struct remote_lock *lock)
|
||||||
@ -889,8 +893,10 @@ static int add_send_request(struct object *obj, struct remote_lock *lock)
|
|||||||
request->next = request_queue_head;
|
request->next = request_queue_head;
|
||||||
request_queue_head = request;
|
request_queue_head = request;
|
||||||
|
|
||||||
|
#ifdef USE_CURL_MULTI
|
||||||
fill_active_slots();
|
fill_active_slots();
|
||||||
step_active_slots();
|
step_active_slots();
|
||||||
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -2523,7 +2529,9 @@ int main(int argc, char **argv)
|
|||||||
if (objects_to_send)
|
if (objects_to_send)
|
||||||
fprintf(stderr, " sending %d objects\n",
|
fprintf(stderr, " sending %d objects\n",
|
||||||
objects_to_send);
|
objects_to_send);
|
||||||
|
#ifdef USE_CURL_MULTI
|
||||||
fill_active_slots();
|
fill_active_slots();
|
||||||
|
#endif
|
||||||
finish_all_active_slots();
|
finish_all_active_slots();
|
||||||
|
|
||||||
/* Update the remote branch if all went well */
|
/* Update the remote branch if all went well */
|
||||||
|
5
http.c
5
http.c
@ -287,6 +287,7 @@ void http_cleanup(void)
|
|||||||
#endif
|
#endif
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
|
|
||||||
|
curl_slist_free_all(pragma_header);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct active_request_slot *get_active_slot(void)
|
struct active_request_slot *get_active_slot(void)
|
||||||
@ -438,11 +439,15 @@ void release_active_slot(struct active_request_slot *slot)
|
|||||||
{
|
{
|
||||||
closedown_active_slot(slot);
|
closedown_active_slot(slot);
|
||||||
if (slot->curl) {
|
if (slot->curl) {
|
||||||
|
#ifdef USE_CURL_MULTI
|
||||||
curl_multi_remove_handle(curlm, slot->curl);
|
curl_multi_remove_handle(curlm, slot->curl);
|
||||||
|
#endif
|
||||||
curl_easy_cleanup(slot->curl);
|
curl_easy_cleanup(slot->curl);
|
||||||
slot->curl = NULL;
|
slot->curl = NULL;
|
||||||
}
|
}
|
||||||
|
#ifdef USE_CURL_MULTI
|
||||||
fill_active_slots();
|
fill_active_slots();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void finish_active_slot(struct active_request_slot *slot)
|
static void finish_active_slot(struct active_request_slot *slot)
|
||||||
|
Loading…
Reference in New Issue
Block a user