Skip to content

Commit 6f9dd67

Browse files
mika-fischergitster
authored andcommitted
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 <[email protected]> Helped-by: Daniel Stenberg <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f696543 commit 6f9dd67

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

http.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,14 +651,14 @@ void run_active_slot(struct active_request_slot *slot)
651651
}
652652

653653
if (slot->in_use && !data_received) {
654-
max_fd = 0;
654+
max_fd = -1;
655655
FD_ZERO(&readfds);
656656
FD_ZERO(&writefds);
657657
FD_ZERO(&excfds);
658+
curl_multi_fdset(curlm, &readfds, &writefds, &excfds, &max_fd);
658659
select_timeout.tv_sec = 0;
659660
select_timeout.tv_usec = 50000;
660-
select(max_fd, &readfds, &writefds,
661-
&excfds, &select_timeout);
661+
select(max_fd+1, &readfds, &writefds, &excfds, &select_timeout);
662662
}
663663
}
664664
#else

0 commit comments

Comments
 (0)