cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH] timeout in ms

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 31 Jan 2007 11:18:25 +0100 (CET)

On Tue, 30 Jan 2007, Dan Fandrich wrote:

>> - /* timeout each second and check the timeout */
>> - switch (Curl_select(tunnelsocket, CURL_SOCKET_BAD, 1000)) {
>> + /* timeout each 10 milliseconds and check the timeout, FIXME: reasonable resolution? */
>> + switch (Curl_select(tunnelsocket, CURL_SOCKET_BAD, 10)) {
>> case -1: /* select() error, stop reading */
>> error = SELECT_ERROR;
>> failf(data, "Proxy CONNECT aborted due to select() error");
>
> Reducing the timeout to 10 ms here turns this practically into a busy loop,
> checking 100 times a second, which could be significant on slower platforms.
> Why can't the timeout value here be set to the value of 'check' and avoid
> the tight loop altogether?

The only reason I can think of is to be able to do the progress
meter/callback, as we try to do that once per second.

With sub-second timeout resolution, we should though not change that 1000 to
10 in such a fixed way, but only make it less than 1000 if there is less than
1000 milliseconds left on the timeout...

Oh, and when such a select()-timeout occurs, we should do the progress magic
which we clearly currenly don't do!

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-01-31