mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:25:07 -05:00
client: shorten default timeout with localhost and async resolving
When chronyd is compiled with asynchronous name resolving, it should always respond quickly. Shorten the default chronyc timeout for localhost.
This commit is contained in:
9
client.c
9
client.c
@@ -2703,7 +2703,7 @@ main(int argc, char **argv)
|
||||
const char *progname = argv[0];
|
||||
const char *hostname = "localhost";
|
||||
const char *conf_file = DEFAULT_CONF_FILE;
|
||||
int quit = 0, ret = 1, multi = 0, auto_auth = 0;
|
||||
int quit = 0, ret = 1, multi = 0, auto_auth = 0, short_timeout = 1;
|
||||
int port = DEFAULT_CANDM_PORT;
|
||||
|
||||
/* Parse command line options */
|
||||
@@ -2713,6 +2713,7 @@ main(int argc, char **argv)
|
||||
if (*argv) {
|
||||
hostname = *argv;
|
||||
}
|
||||
short_timeout = 0;
|
||||
} else if (!strcmp(*argv, "-p")) {
|
||||
++argv, --argc;
|
||||
if (*argv) {
|
||||
@@ -2746,6 +2747,12 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (short_timeout) {
|
||||
#ifdef FEAT_ASYNCDNS
|
||||
initial_timeout /= 10;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (isatty(0) && isatty(1) && isatty(2)) {
|
||||
on_terminal = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user