curl / Mailing Lists / curl-library / Single Mail


Re: max_fd if curl_multi_fdset() is called directly after curl_multi_add_handle()

From: Wolfgang Steinwender <>
Date: Wed, 8 Nov 2017 15:22:58 +0100

On 08.11.2017 14:37, Daniel Stenberg wrote:
> On Wed, 8 Nov 2017, Wolfgang Steinwender wrote:
>> Documentation for curl_multi_fdset:
>> When libcurl returns -1 in max_fd [..]
>> You then need to wait a while before you proceed and call curl_multi_perform anyway. How long to
>> wait? We suggest 100 milliseconds at least [..]
>> But: If i call curl_multi_fdset() directly after curl_multi_add_handle(), max_fd is always -1. If
>> I wait 100ms in this case, start of the transfer is delayed by 100ms. I don't think that is required.
> You're right.
> Maybe we should improve how that is explained. When you figure out what file descriptors to wait
> for, you should also ask libcurl for the *maximum* time to wait. curl_multi_timeout() tells you that.
> In this case, when you have just called curl_multi_add_handle(), curl_multi_timeout() will return
> saying you shouldn't wait at all but you should call libcurl immediately as it has things to do. In
> this moment in time, the -1 value in max_fd is less of a concern.
curl_multi_timeout() says maximum 0ms, curl_multi_fdset() at least 100ms.
A valid value from curl_multi_timeout() *always* takes precedence over max_fd = -1 or
only immediatly after curl_multi_add_handle()?

Received on 2017-11-08