MCPcopy Index your code
hub / github.com/git/git / get_active_slot

Function get_active_slot

http.c:1575–1661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1573}
1574
1575struct active_request_slot *get_active_slot(void)
1576{
1577 struct active_request_slot *slot = active_queue_head;
1578 struct active_request_slot *newslot;
1579
1580 int num_transfers;
1581
1582 /* Wait for a slot to open up if the queue is full */
1583 while (active_requests >= max_requests) {
1584 curl_multi_perform(curlm, &num_transfers);
1585 if (num_transfers < active_requests)
1586 process_curl_messages();
1587 }
1588
1589 while (slot != NULL && slot->in_use)
1590 slot = slot->next;
1591
1592 if (!slot) {
1593 newslot = xmalloc(sizeof(*newslot));
1594 newslot->curl = NULL;
1595 newslot->in_use = 0;
1596 newslot->next = NULL;
1597
1598 slot = active_queue_head;
1599 if (!slot) {
1600 active_queue_head = newslot;
1601 } else {
1602 while (slot->next != NULL)
1603 slot = slot->next;
1604 slot->next = newslot;
1605 }
1606 slot = newslot;
1607 }
1608
1609 if (!slot->curl) {
1610 slot->curl = curl_easy_duphandle(curl_default);
1611 curl_session_count++;
1612 }
1613
1614 active_requests++;
1615 slot->in_use = 1;
1616 slot->results = NULL;
1617 slot->finished = NULL;
1618 slot->callback_data = NULL;
1619 slot->callback_func = NULL;
1620
1621 if (curl_cookie_file && !strcmp(curl_cookie_file, "-")) {
1622 warning(_("refusing to read cookies from http.cookiefile '-'"));
1623 FREE_AND_NULL(curl_cookie_file);
1624 }
1625 curl_easy_setopt(slot->curl, CURLOPT_COOKIEFILE, curl_cookie_file);
1626 if (curl_save_cookies && (!curl_cookie_file || !curl_cookie_file[0])) {
1627 curl_save_cookies = 0;
1628 warning(_("ignoring http.savecookies for empty http.cookiefile"));
1629 }
1630 if (curl_save_cookies)
1631 curl_easy_setopt(slot->curl, CURLOPT_COOKIEJAR, curl_cookie_file);
1632 curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, pragma_header);

Callers 15

fetch_alternatesFunction · 0.85
http_requestFunction · 0.85
new_http_object_requestFunction · 0.85
start_mkcolFunction · 0.85
start_putFunction · 0.85
start_moveFunction · 0.85
refresh_lockFunction · 0.85
lock_remoteFunction · 0.85
unlock_remoteFunction · 0.85
remote_lsFunction · 0.85
locking_availableFunction · 0.85

Calls 5

process_curl_messagesFunction · 0.85
warningFunction · 0.85
curl_empty_auth_enabledFunction · 0.85
init_curl_http_authFunction · 0.85
xmallocFunction · 0.70

Tested by

no test coverage detected