cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_multi_fdset and the threaded resolver

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 5 Aug 2011 00:04:35 +0200 (CEST)

On Thu, 4 Aug 2011, Sorin Manolache wrote:

> I've been using curl_multi_fdset with a curl library compiled without the
> threaded resolver and relied upon it returning a positive number of
> descriptors. Now the sysadmins replaced the curl lib with one that has the
> threaded resolver and my application does not work any more.

Right. That was an incorrect assumption.

> What is the correct/portable/future-proof way to change my application in
> order to support the threaded resolver? What should my application do if
> maxfds = -1? Sleep (select with timeout on an empty set of descriptors) and
> retry later, as suggested in some posts dating from 21-25 Apr 2010? Are
> there rules of thumb for selecting the smallest sleep interval such that
> maxfds > 0 after wakeup?

In that case, there's a name resolving going on and there's nothing available
for the application to wait on.

The "best possible" time for you to wait before asking libcurl anyway is
probably rather specific to what your app is doing and where it runs, but I
would assume that in most practical use-cases with high speed processors you
would never sleep for much more than a hundred milliseconds. Possibly you
start very low and increase the timeout in every loop up to a certain limit.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-08-05