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

Function run_active_slot

http.c:1744–1817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1742}
1743
1744void run_active_slot(struct active_request_slot *slot)
1745{
1746 fd_set readfds;
1747 fd_set writefds;
1748 fd_set excfds;
1749 int max_fd;
1750 struct timeval select_timeout;
1751 int finished = 0;
1752
1753 slot->finished = &finished;
1754 while (!finished) {
1755 step_active_slots();
1756
1757 if (slot->in_use) {
1758 long curl_timeout;
1759 curl_multi_timeout(curlm, &curl_timeout);
1760 if (curl_timeout == 0) {
1761 continue;
1762 } else if (curl_timeout == -1) {
1763 select_timeout.tv_sec = 0;
1764 select_timeout.tv_usec = 50000;
1765 } else {
1766 select_timeout.tv_sec = curl_timeout / 1000;
1767 select_timeout.tv_usec = (curl_timeout % 1000) * 1000;
1768 }
1769
1770 max_fd = -1;
1771 FD_ZERO(&readfds);
1772 FD_ZERO(&writefds);
1773 FD_ZERO(&excfds);
1774 curl_multi_fdset(curlm, &readfds, &writefds, &excfds, &max_fd);
1775
1776 /*
1777 * It can happen that curl_multi_timeout returns a pathologically
1778 * long timeout when curl_multi_fdset returns no file descriptors
1779 * to read. See commit message for more details.
1780 */
1781 if (max_fd < 0 &&
1782 (select_timeout.tv_sec > 0 ||
1783 select_timeout.tv_usec > 50000)) {
1784 select_timeout.tv_sec = 0;
1785 select_timeout.tv_usec = 50000;
1786 }
1787
1788 select(max_fd+1, &readfds, &writefds, &excfds, &select_timeout);
1789 }
1790 }
1791
1792 /*
1793 * The value of slot->finished we set before the loop was used
1794 * to set our "finished" variable when our request completed.
1795 *
1796 * 1. The slot may not have been reused for another request
1797 * yet, in which case it still has &finished.
1798 *
1799 * 2. The slot may already be in-use to serve another request,
1800 * which can further be divided into two cases:
1801 *

Callers 14

fetch_alternatesFunction · 0.85
http_fetch_packFunction · 0.85
fetch_objectFunction · 0.85
finish_all_active_slotsFunction · 0.85
run_one_slotFunction · 0.85
refresh_lockFunction · 0.85
lock_remoteFunction · 0.85
unlock_remoteFunction · 0.85
remote_lsFunction · 0.85
locking_availableFunction · 0.85
update_remoteFunction · 0.85
update_remote_info_refsFunction · 0.85

Calls 1

step_active_slotsFunction · 0.85

Tested by

no test coverage detected