cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Threaded resolver provides bad file descriptor on Windows

From: Constantine Sapuntzakis <csapuntz_at_gmail.com>
Date: Fri, 2 Jul 2010 10:09:11 -0700

On Fri, Jul 2, 2010 at 7:35 AM, Brian Makin <makin_at_vivisimo.com> wrote:
> In commit 483ff1ca, the following code was added to lib/hostthre.c:
>
>> /* This socket is only to keep Curl_resolv_fdset() and select() happy;
>>  * should never become signalled for read since it's unbound but
>>  * Windows needs at least 1 socket in select().
>>  */
>> td->dummy_sock = socket(AF_INET, SOCK_DGRAM, 0);
>> if (td->dummy_sock == CURL_SOCKET_BAD)
>>   goto err_exit;
>

> Since no data will ever become available on this socket, performing a
> select() on the fdset returned by curl_multi_fdset will simply timeout.
> This means that code and servers that previously were fairly responsive
> now have essentially a forced sleep of the select timeout period.

> If so, what is the recommended workaround?

Call curl_multi_timeout to get the right timeout to pass to select
instead of always
passing a second.

BTW, in my code, if curl_multi_timeout returns more than 1 second,
then I still pass 1 second to select.

I'm sorry that the examples were misleading - we should have taken
care to update them.

If that doesn't fix the problem, let me know. There could be some other defect.

-Costa
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-02