This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] resolv: Allow new "timeout-ms" option


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]