cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: FW: Calling curl_multi_socket_action after unpausing is not intuitive

From: Damian Lezama <Damian.Lezama_at_riverbed.com>
Date: Thu, 20 Mar 2014 22:47:44 +0000

> -----Original Message-----
> From: curl-library [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of
> Daniel Stenberg
> Sent: Thursday, March 20, 2014 3:22 PM
>
> On Thu, 20 Mar 2014, Damian Lezama wrote:
>
> > Unpausing a transfer happens in a completely different part of the
> > logic. It is still part of the main loop, or else things could get really
> complicated.
> > What I expected to happen, was having my socket and/or timer callbacks
> > called by curl when unpausing, so when I went into the wait again my
> > state was correct.
>
> You mean you'd like them directly from within the unpause function? Yeah, I
> can see how that could be useful. I was only wary of adding such a behavior
> to the code as perhaps that would cause some interesting side-effects to
> existing applications if we would do that. Or do you think I'm being overly
> cautious?

[Damian] I believe that calling the timeout function to set the timeout to 0 from
unpause would be enough. I understand how calling any callback from unpause may
be something the lib user may not expect.

> > Just my 2 cents, I believe many people will fall into the same trap,
> > since the behavior is not intuitive.
>
> It also points to the documentation not being good enough. You should of
> course have been told in there how it works and what to expect from it... Do
> you have any suggestion on how we can clarify it?

[Damian] The doc could explicitly say that there are three cases where you should call
curl_multi_perform:
1- Socket activity
2- Timeout
3- After calling pause.
However, I believe the other option is preferable: make unpause call the timeout function,
then case 3 does not need any special handling, as soon as the loop goes to the wait it will
do what it has to do (call curl_multi_perform immediately since timeout is now 0)

> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-03-20