curl-library
Re: can't go ahead if event isn't finished in libevent
Date: Tue, 2 May 2017 21:21:59 +0800
sorry let me modify a description: In the situation below
*static* *void* *fifo_cb*(*int* fd, *short* event, *void* *arg)
{
...
*...*
new_conn(s, arg); */* if we read a URL, go get it! */ *
}
*else*
*break*;
} *while*(rv != EOF);
*while(1); *// I add this line to block the function but I already
add easy handle to multi handle
}
then *sock_cb* will never executed, the application will only execute
*multi_timer_cb*
I'm sure I already add easy handle and finish executing *new_conn* but
*sock_cb* doesn't activate
That's the problem I don't understand.
2017-05-02 19:33 GMT+08:00 Daniel Stenberg <daniel_at_haxx.se>:
> On Tue, 2 May 2017, Pahome Chen wrote:
>
> I thought it will call multi_timer_cb when called curl_multi_add_handle
>> immediately like below:
>>
>> rc = curl_multi_add_handle
>> <https://curl.haxx.se/libcurl/c/curl_multi_add_handle.html>(g->multi,
>> conn->easy);
>> mcode_or_die(*"new_conn: curl_multi_add_handle"*, rc);
>>
>> */* note that the add_handle() will set a time-out to trigger very soon
>> so
>> that the necessary socket_action() call will be called by this app */
>> *
>>
>
> libcurl calls the timer callback to inform your application that it wants
> a new timer set so that you can tell libcurl when that timer has expired.
>
> so socket_action() will wait for exiting event loop in a blocking way?
>>
>
> curl_multi_socket_action() doesn't wait for events at all, your
> application calls that after it noticed an event on a socket that libcurl
> asked your application to "monitor".
>
> --
>
> / daniel.haxx.se
>
-- Best Regards, pahome
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-05-02