On Mon, 23 Jun 2025, Nicolas Martin via curl-library wrote:

1- multi_timer_cb

It's an optimization so libcurl will ask to timeout sooner and data will be read/written without waiting for a full timeout.

It's more than "an optimization". In order to function properly, to do timeouts and things correctly libcurl sometimes need to be invoked again without any new socket activity.

This callback tells the application to set the timer for when libcurl wants to be told the next time.

So in my application, it's OK not to use this timer.

No. Don't do that. Failing to use the timer properly will probably make libcurl behave unreliably. Managing the timer should not be complicated nor a lot of work for an application.

2-  timer_cb
I don't understand the need to set this timer. If epoll exits with code 0,
that means a timeout has passed and we can call
curl_multi_socket_action(CURL_SOCKET_TIMEOUT). Why use a timerfd for this ?

This is the callback called by the event library when the timer expires. The timer set to the time libcurl told the application about in the CURLMOPT_SOCKETFUNCTION callback invoke.

I'm wondering if there is an existing function in libcurl that is able to say if a file descriptor belongs to libcurl or not ?

No, there isn't.

--

 / daniel.haxx.se || https://rock-solid.curl.dev
--
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to