]> granicus.if.org Git - curl/commitdiff
- Set the timeout for easy handles to expire really soon after addition or
authorDaniel Stenberg <daniel@haxx.se>
Wed, 2 May 2007 13:47:56 +0000 (13:47 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 2 May 2007 13:47:56 +0000 (13:47 +0000)
  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.

CHANGES
RELEASE-NOTES
lib/multi.c

diff --git a/CHANGES b/CHANGES
index 72c0fad4a6f146234081ad09004df1bcf8e68b32..d7235d083bb2a4f141565eb4f5f918886c3c04b0 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,13 @@
 
                                   Changelog
 
+Daniel S (2 May 2007)
+- 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.
+
 Dan F (30 April 2007)
 - Improved the test harness to allow running test servers on other than
   the default port numbers, allowing more than one test suite to run
index f4084218c33e391a9ebde02cad880aec84da4460..2104664337af0cc995da5e1b8188e0ea389b9101 100644 (file)
@@ -33,6 +33,7 @@ This release includes the following bugfixes:
  o curl_easy_duphandle() crash
  o curl -V / curl_verion*() works even when GnuTLS is used on a system without
    a good random source
+ o curl_multi_socket() not "noticing" newly added handles
 
 This release includes the following known bugs:
 
@@ -56,6 +57,6 @@ advice from friends like these:
 
  Song Ma, Dan Fandrich, Yang Tse, Jay Austin, Robert Iakobashvil,
  James Housley, Daniel Black, Steve Little, Sonia Subramanian, Peter O'Gorman,
- Frank Hempel
+ Frank Hempel, Michael Wallner
 
         Thanks! (and sorry if I forgot to mention someone)
index 76614c7608a28ba0169e26be0607c3252da3c658..4b42981e88eb3fad7222af868d32bbbe2800de52 100644 (file)
@@ -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;
 }