cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: OPENSOCKETFUNCTION hook not called for all socket creations on Windows

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 28 Dec 2011 21:11:59 +0100 (CET)

On Wed, 28 Dec 2011, Christian Hägele wrote:

> After I looked at the code again I see that it won't be easily possible to
> get rid of the dummy-socket without breaking existing code. I tried to
> just remove it on my windows-code and it works perfect, but that's because
> I don't use the curl_multi_fdset-API (I use the CURLMOPT_SOCKETFUNCTION).
> All the existing tests and example I saw so far assume that they won't get
> a error from the select call after curl_multi_fdset. On windows the select-
> call returns an error when called with empty FD-sets.

If curl_multi_fdset() returns with maxfd == -1, as it would if no file
desrciptor is present to get returned, then the appplication should not call
select() in the first place.

If there are examples that don't take this into account, then the examples are
wrong and should be fixed. After all, the API has always been documented to
possibly return this.

> What do you think? My proposal is to move the dummy-socket in the
> Curl_multi- struct and create it on-demand (means on the irst call and only
> on windows) in the curl_multi_fdset-function.

If so, when would it be removed again? I don't think that sounds like a good
approach. I think working harder to completely get rid of it is a better idea.

-- 
  / daniel.haxx.se

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