Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin/loop: fix loop detection when an upstream DNS server is not reachable #2255

Merged
merged 1 commit into from
Oct 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions plugin/loop/loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ func (l *Loop) inc() {
l.i++
}

func (l *Loop) reset() {
l.Lock()
defer l.Unlock()
l.i = 0
}

func (l *Loop) setDisabled() {
l.Lock()
defer l.Unlock()
Expand Down
1 change: 1 addition & 0 deletions plugin/loop/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func setup(c *caddy.Controller) error {

for time.Now().Before(deadline) {
if _, err := l.exchange(addr); err != nil {
l.reset()
time.Sleep(1 * time.Second)
continue
}
Expand Down