curl-library
[PATCH] patch series for improved multi interface
Date: Tue, 10 Aug 2010 14:23:03 +0200 (CEST)
Hiya
In my quest to improve the multi interface, I'm now presenting my work as a
series of patches meant to be merged into mainline after this pending release.
For info and easier reviewing I'm posting them here first. Feedback, questions
and comments are all welcome!
The four patches, straight from git, are as follows:
commit 8b41b37881180616c6fb99c25a1f3aadbae3ef56
Author: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon Aug 9 00:01:36 2010 +0200
multi: make curl_multi_info_read perform O(1)
Instead of looping over all attached easy handles, this now keeps a list
of messages in the multi handle. It allows curl_multi_info_read() to
perform O(1) no matter how many easy handles that are handled. This is
of importance since this function may be polled very frequently by apps
using the multi interface.
commit 6792d839e263ba2dacad7e9ecf8c65665fc7a827
Author: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue Aug 10 10:52:26 2010 +0200
Curl_llist_insert_next: allow insertion first in the list
When we specify the "insert after" entry as NULL, this function now
inserts the new entry first in the list.
commit a09f1cf748b466c472f2f0819c55bfa67e5e3d7b
Author: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue Aug 10 11:02:07 2010 +0200
multi: support timeouts
Curl_expire() is now expanded to hold a list of timeouts for each easy
handle. Only the closest in time will be the one used as the primary
timeout for the handle and will be used for the splay tree (which sorts
and lists all handles within the multi handle).
When the main timeout has triggered/expired, the next timeout in time
that is kept in the list will be moved to the main timeout position and
used as the key to splay with. This way, all timeouts that are set with
Curl_expire() internally will end up as a proper timeout. Previously any
Curl_expire() that set a _later_ timeout than what was already set was
just silently ignored and thus missed.
Setting Curl_expire() with timeout 0 (zero) will cancel all previously
added timeouts.
Corrects known bug #62.
commit 2bb53f6739f31f00ef9065004b75f69bc2486d49
Author: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue Aug 10 14:12:05 2010 +0200
multi: use timeouts properly for MAX_RECV/SEND_SPEED
When detecting that the send or recv speed, the multi interface changes
state to TOOFAST and previously there was no timeout set that would
force a recheck but it would rely on the application to somehow call
libcurl anyway. This now sets a timeout for a suitable future time to
check again if the average transfer speed is then below the threshold
again.
-- / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
- TEXT/x-diff attachment: 0001-multi-make-curl_multi_info_read-perform-O-1.patch
- TEXT/x-diff attachment: 0002-Curl_llist_insert_next-allow-insertion-first-in-the-.patch
- TEXT/x-diff attachment: 0003-multi-support-timeouts.patch
- TEXT/x-diff attachment: 0004-multi-use-timeouts-properly-for-MAX_RECV-SEND_SPEED.patch