cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: v2 of patch to fix busy-waiting during Windows async name lookup

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 6 Sep 2009 19:59:18 +0200 (CEST)

On Sun, 6 Sep 2009, Constantine Sapuntzakis wrote:

> Big question: whether to get rid of dummy socket on name resolve on Windows
> outright (instead of the CURLMOPT_NODUMMY flag). On the one hand, the dummy
> socket causes busy waits on some versions of Windows. On the other hand,
> removing it will require code changes to curl windows clients - small
> changes but code changes nonetheless.

Thanks for your continued work on this issue!

I think a CURLMOPT_NODUMMY option is pointless. Existing apps _should_ not
need any fixing at all if they've just read the documentation properly and
ackowledge the return code properly from libcurl functions. We make an effort
to document functions to work portably, without mentioning specific operating
systems - as far as possible.

> * More warnings about select() in the documentation

I don't like them. They mention unrelated things and Windows-specific quirks
much more than we need. It's enough to say that fdset returns -1 and sets no
bitmasks when there's no socket to wait for, and it is good to mention that
this can happen during a transfer due to how libcurl is made internally, but
there's no need to mention Windows or how its select() works (which probably
also is something it shares with other operating systems).

> * modified examples to handle maxfd==-1 on Windows

I don't like that either. Several of those examples you modify have huge
comment blobs before the select() call explaining how it needs to check the
return code EXACTLY because this possible -1 return code. The -1 return is not
unique to Windows in any way but can in fact be returned by libcurl during
circumstances on pretty much all operating systems.

So IMO: we either make the examples work portably and remove the comments, or
we leave the comment in there and don't half-adress the issue.

And a minor nit: we don't use // comments in curl code.

-- 
  / daniel.haxx.se
Received on 2009-09-06