aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-05-02 13:47:56 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-05-02 13:47:56 +0000
commit2f0539d8803e4f270c8584994f7fc8b90cd5e15c (patch)
tree7eb613105f59ee3533c26bcb880f1f32abaf2f7e /lib
parent6f7d0a7cbd0578dc20a22279269a14a143d7e8ee (diff)
- Set the timeout for easy handles to expire really soon after addition or
when CURLM_CALL_MULTI_PERFORM is returned from curl_multi_socket*/perform, to make applications using only curl_multi_socket() to properly function when adding easy handles "on the fly". Bug report and test app provided by Michael Wallner.
Diffstat (limited to 'lib')
-rw-r--r--lib/multi.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 76614c760..4b42981e8 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -469,6 +469,14 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
/* make the SessionHandle struct refer back to this struct */
easy->easy_handle->set.one_easy = easy;
+ /* Set the timeout for this handle to expire really soon so that it will
+ be taken care of even when this handle is added in the midst of operation
+ when only the curl_multi_socket() API is used. During that flow, only
+ sockets that time-out or have actions will be dealt with. Since this
+ handle has no action yet, we make sure it times out to get things to
+ happen. */
+ Curl_expire(easy->easy_handle, 10);
+
/* increase the node-counter */
multi->num_easy++;
@@ -1385,6 +1393,17 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
multi->num_msgs++; /* increase message counter */
}
+ if(CURLM_CALL_MULTI_PERFORM == result)
+ /* Set the timeout for this handle to expire really soon so that it will
+ be taken care of even when this handle is added in the midst of
+ operation when only the curl_multi_socket() API is used. During that
+ flow, only sockets that time-out or have actions will be dealt
+ with. Since this handle has no action yet, we make sure it times out to
+ get things to happen. Also, this makes it less important for callers of
+ the curl_multi_* functions to bother about the CURLM_CALL_MULTI_PERFORM
+ return code, as long as they deal with the timeouts properly. */
+ Curl_expire(easy->easy_handle, 10);
+
return result;
}