summaryrefslogtreecommitdiff
path: root/docs/examples/fopen.c
diff options
context:
space:
mode:
Diffstat (limited to 'docs/examples/fopen.c')
-rw-r--r--docs/examples/fopen.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/examples/fopen.c b/docs/examples/fopen.c
index 35e24b11f..f21526b29 100644
--- a/docs/examples/fopen.c
+++ b/docs/examples/fopen.c
@@ -144,6 +144,8 @@ fill_buffer(URL_FILE *file,int want,int waittime)
do
{
int maxfd = -1;
+ long curl_timeo = -1;
+
FD_ZERO(&fdread);
FD_ZERO(&fdwrite);
FD_ZERO(&fdexcep);
@@ -152,6 +154,15 @@ fill_buffer(URL_FILE *file,int want,int waittime)
timeout.tv_sec = 60; /* 1 minute */
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);