summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorMika Fischer <mika.fischer@zoopnet.de>2011-11-04 15:19:25 +0100
committerJunio C Hamano <gitster@pobox.com>2011-11-04 10:46:25 -0700
commit6f9dd67ffea3e86276a73e522ce1186a99bbe65d (patch)
treea417882d167aabf089b4f17bf888f1f20f9d1f53 /http.c
parentf696543dad6c7ba27b0c4fab167a5687263a9ba0 (diff)
downloadgit-6f9dd67ffea3e86276a73e522ce1186a99bbe65d.tar.gz
http.c: Use curl_multi_fdset to select on curl fds instead of just sleeping
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>
Diffstat (limited to 'http.c')
-rw-r--r--http.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/http.c b/http.c
index b2ae8de16d..a815f628b9 100644
--- a/http.c
+++ b/http.c
@@ -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