aboutsummaryrefslogtreecommitdiff
path: root/plugin/loop/setup.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-07-22 11:54:02 +0100
committerGravatar GitHub <noreply@github.com> 2018-07-22 11:54:02 +0100
commitb7ae8d4e86ac3b13d51f2995e04c48ba21cc5836 (patch)
treefd9deb25a27cdafeee875497689dbbaad56a3eb8 /plugin/loop/setup.go
parent170e1d6b66d902d326539618896f0153f9349a23 (diff)
downloadcoredns-b7ae8d4e86ac3b13d51f2995e04c48ba21cc5836.tar.gz
coredns-b7ae8d4e86ac3b13d51f2995e04c48ba21cc5836.tar.zst
coredns-b7ae8d4e86ac3b13d51f2995e04c48ba21cc5836.zip
plugin/loop: add missing break (#1992)
The Onstartup loop wouldn't call break after the first success, thereby sending the query multiple times and halting the process. Some small other optimizations as well. Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/loop/setup.go')
-rw-r--r--plugin/loop/setup.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugin/loop/setup.go b/plugin/loop/setup.go
index 415a8db2f..28829fcb4 100644
--- a/plugin/loop/setup.go
+++ b/plugin/loop/setup.go
@@ -37,10 +37,10 @@ func setup(c *caddy.Controller) error {
go func() {
deadline := time.Now().Add(30 * time.Second)
conf := dnsserver.GetConfig(c)
+ lh := conf.ListenHosts[0]
+ addr := net.JoinHostPort(lh, conf.Port)
for time.Now().Before(deadline) {
- lh := conf.ListenHosts[0]
- addr := net.JoinHostPort(lh, conf.Port)
if _, err := l.exchange(addr); err != nil {
time.Sleep(1 * time.Second)
continue
@@ -50,6 +50,8 @@ func setup(c *caddy.Controller) error {
time.Sleep(2 * time.Second)
l.setDisabled()
}()
+
+ break
}
l.setDisabled()
}()