diff options
Diffstat (limited to 'docs/examples/multi-post.c')
-rw-r--r-- | docs/examples/multi-post.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/examples/multi-post.c b/docs/examples/multi-post.c index 0d3f78e5e..df574ae72 100644 --- a/docs/examples/multi-post.c +++ b/docs/examples/multi-post.c @@ -79,6 +79,8 @@ int main(int argc, char *argv[]) fd_set fdexcep; int maxfd = -1; + long curl_timeo = -1; + FD_ZERO(&fdread); FD_ZERO(&fdwrite); FD_ZERO(&fdexcep); @@ -87,6 +89,15 @@ int main(int argc, char *argv[]) timeout.tv_sec = 1; timeout.tv_usec = 0; + curl_multi_timeout(multi_handle, &curl_timeo); + if(curl_timeo >= 0) { + timeout.tv_sec = curl_timeo / 1000; + if(timeout.tv_sec > 1) + timeout.tv_sec = 1; + else + timeout.tv_usec = (curl_timeo % 1000) * 1000; + } + /* get file descriptors from the transfers */ curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); |