Skip to content

Commit

Permalink
http.c: Use curl_multi_fdset to select on curl fds instead of just sl…
Browse files Browse the repository at this point in the history
…eeping

Instead of sleeping unconditionally for a 50ms, when no data can be read
from the http connection(s), use curl_multi_fdset() to obtain the actual
file descriptors of the open connections and use them in the select call.
This way, the 50ms sleep is interrupted when new data arrives.

Signed-off-by: Mika Fischer <mika.fischer@zoopnet.de>
Helped-by: Daniel Stenberg <daniel@haxx.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Mika Fischer authored and Junio C Hamano committed Nov 4, 2011
1 parent f696543 commit 6f9dd67
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,14 +651,14 @@ void run_active_slot(struct active_request_slot *slot)
}

if (slot->in_use && !data_received) {
max_fd = 0;
max_fd = -1;
FD_ZERO(&readfds);
FD_ZERO(&writefds);
FD_ZERO(&excfds);
curl_multi_fdset(curlm, &readfds, &writefds, &excfds, &max_fd);
select_timeout.tv_sec = 0;
select_timeout.tv_usec = 50000;
select(max_fd, &readfds, &writefds,
&excfds, &select_timeout);
select(max_fd+1, &readfds, &writefds, &excfds, &select_timeout);
}
}
#else
Expand Down

0 comments on commit 6f9dd67

Please sign in to comment.