curl-library
Re: [PATCH] patch series for improved multi interface
Date: Mon, 16 Aug 2010 19:43:43 +0200 (CEST)
On Mon, 16 Aug 2010, Constantine Sapuntzakis wrote:
> Thanks for this! The new timeout behavior is better than the old behavior.
Great! And thanks for checking it out.
> Still worried about Curl_expire. Curl_expire(, 0); cancels all the pending
> timeouts. This is dangerous as two parts of the code that use timeouts for
> different reasons (e.g. one for polling and another for protocol timeout)
> could clobber each other. Do you share this concern or is the risk false?
I agree completely with this concern and I find it an excellent next step to
address.
> Here is an idea:
>
> 1) add a struct timeout
>
> 2) Change Curl_expire to take 3 args. The new sig would be:
>
> void Curl_expire(struct SessionHandle *, struct timeout *, long milli);
>
> This way, for example, the thread DNS resolver could embed a different
> struct timeout in its data structures than the standard curl handle. And
> Curl_expire( , , 0) would only cancel the specified timeout.
I agree about the principle, but I think we can make it even nicer:
* We make Curl_expire() return a pointer to the newly added timeout struct.
* We introduce a Curl_rmexpire() (perhaps a better name is needed) that more
explicitly removes the given timer, or if set to NULL, the entire list of
timers. (I think the most common use of 0 is in fact to quite accurately
remove all timers.)
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2010-08-16