diff options
-rw-r--r-- | http.c | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -651,13 +651,29 @@ void run_active_slot(struct active_request_slot *slot) } if (slot->in_use && !data_received) { +#if LIBCURL_VERSION_NUM >= 0x070f04 + long curl_timeout; + curl_multi_timeout(curlm, &curl_timeout); + if (curl_timeout == 0) { + continue; + } else if (curl_timeout == -1) { + select_timeout.tv_sec = 0; + select_timeout.tv_usec = 50000; + } else { + select_timeout.tv_sec = curl_timeout / 1000; + select_timeout.tv_usec = (curl_timeout % 1000) * 1000; + } +#else + select_timeout.tv_sec = 0; + select_timeout.tv_usec = 50000; +#endif + 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+1, &readfds, &writefds, &excfds, &select_timeout); } } |