curl-library
Re: multi_socket and epoll example
Date: Thu, 9 Aug 2018 17:10:21 +0100
On Thu, Aug 9, 2018 at 7:56 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Thu, 9 Aug 2018, James Read wrote:
>
> Everything seems to work fine. With a single URL and with multiple URLs.
>> The only issue I have is the throughput.
>>
>
> Could be vphiperfifo.c example issues.
>
> For example, I don't see how it handles API timeouts properly: the timeout
> that libcurl tells the CURLMOPT_TIMERFUNCTION callback should fire after
> that time and curl_multi_socket_action( ... CURL_SOCKET_TIMEOUT ...) should
> be called.
>
>
As far as I can see curl_multi_socket_action is called.
/* Update the timer after curl_multi library does it's thing. Curl will
* inform us through this callback what it wants the new timeout to be,
* after it does some work. */
static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g)
{
struct itimerspec its;
CURLMcode rc;
fprintf(MSG_OUT, "multi_timer_cb: Setting timeout to %ld ms\n",
timeout_ms);
timerfd_settime(g->tfd, /*flags=*/ 0, &its, NULL);
if(timeout_ms > 0) {
its.it_interval.tv_sec = 1;
its.it_interval.tv_nsec = 0;
its.it_value.tv_sec = timeout_ms / 1000;
its.it_value.tv_nsec = (timeout_ms % 1000) * 1000;
timerfd_settime(g->tfd, /*flags=*/ 0, &its, NULL);
}
else if(timeout_ms == 0) {
rc = curl_multi_socket_action(g->multi,
CURL_SOCKET_TIMEOUT, 0,
&g->still_running);
mcode_or_die("multi_timer_cb: curl_multi_socket_action", rc);
}
else {
memset(&its, 0, sizeof(struct itimerspec));
timerfd_settime(g->tfd, /*flags=*/ 0, &its, NULL);
}
return 0;
}
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-08-09