summaryrefslogtreecommitdiffstats
path: root/lib/libc/asr/asr.c
diff options
context:
space:
mode:
authoreric <eric@openbsd.org>2013-03-31 19:42:10 +0000
committereric <eric@openbsd.org>2013-03-31 19:42:10 +0000
commit7234c6e9d0836be40599e4e2599514c202b67bb6 (patch)
tree35139907ba6a573752b01da78f69c1652b222e84 /lib/libc/asr/asr.c
parentAdd a couple commas, as suggested by jmc@ (diff)
downloadwireguard-openbsd-7234c6e9d0836be40599e4e2599514c202b67bb6.tar.xz
wireguard-openbsd-7234c6e9d0836be40599e4e2599514c202b67bb6.zip
Principle of least astonishment: implement nameserver retry/backoff as
in the former resolver.
Diffstat (limited to 'lib/libc/asr/asr.c')
-rw-r--r--lib/libc/asr/asr.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/libc/asr/asr.c b/lib/libc/asr/asr.c
index ecf31322248..5e4e0e15d06 100644
--- a/lib/libc/asr/asr.c
+++ b/lib/libc/asr/asr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asr.c,v 1.17 2013/03/30 20:00:08 eric Exp $ */
+/* $OpenBSD: asr.c,v 1.18 2013/03/31 19:42:10 eric Exp $ */
/*
* Copyright (c) 2010-2012 Eric Faurot <eric@openbsd.org>
*
@@ -531,8 +531,8 @@ asr_ctx_create(void)
ac->ac_hostfile = DEFAULT_HOSTFILE;
ac->ac_nscount = 0;
- ac->ac_nstimeout = 1000;
- ac->ac_nsretries = 3;
+ ac->ac_nstimeout = 5;
+ ac->ac_nsretries = 4;
return (ac);
}
@@ -939,6 +939,12 @@ asr_iter_ns(struct async *as)
DPRINT("asr: asr_iter_ns(): cycle %i\n", as->as_ns_cycles);
}
+ as->as_timeout = 1000 * (as->as_ctx->ac_nstimeout << as->as_ns_cycles);
+ if (as->as_ns_cycles > 0)
+ as->as_timeout /= as->as_ctx->ac_nscount;
+ if (as->as_timeout < 1000)
+ as->as_timeout = 1000;
+
return (0);
}