This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] resolv: Allow new "timeout-ms" option
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Paul Stewart <pstew at chromium dot org>
- Cc: libc-alpha at sourceware dot org, vapier at chromium dot org
- Date: Thu, 21 Jun 2012 09:48:11 -0700
- Subject: Re: [PATCH] resolv: Allow new "timeout-ms" option
- References: <20120621144313.A1F34201EC@glenhelen.mtv.corp.google.com>
On 06/21/2012 06:26 AM, Paul Stewart wrote:
> Allow an option to specify DNS timeout in milliseconds instead
> of seconds.
Some dumb questions:
Why mess with milliseconds if we can do nanoseconds?
(This would be for the future, when chromium gets fast. :-)
>+# define RES_MINWAIT_MS 5 /* Minimum wait time, in milliseconds */
Why impose this limit? Isn't that arbitrary?
Shouldn't users be able to wait for 4 ms
if they really want to?
> + int seconds = 0;
> + int milliseconds = 0;
The first initialization is unnecessary. The second one can be
moved to the 'else' branch that needs it; this is clearer.
> + if (seconds < 0 ||
> + (seconds == 0 && milliseconds < RES_MINWAIT_MS)) {
Put the "||" at the start of the next line (usual glibc style).
> + } else {
> + seconds = operation_time;
> + if (seconds <= 0)
> + seconds = 1;
> + }
Shouldn't the default timeout be the same regardless of
whether RES_TIMEOUT_MS is specified? As things stand,
the default timeout is 1 s without the flag, 5 ms with it;
is that really intended?