plugin/forward: move Dial goroutine out (#1738)

Rework the TestProxyClose - close the proxy in the *same* goroutine
as where we started it. Close channels as long as we don't get dataraces
(this may need another fix).

Move the Dial goroutine out of the connManager - this simplifies things
*and* makes another goroutine go away and removes the need for connErr
channels - can now just be dns.Conn.

Also:

Revert "plugin/forward: gracefull stop (#1701)"
This reverts commit 135377bf77.

Revert "rework TestProxyClose (#1735)"
This reverts commit 9e8893a0b5.
This commit is contained in:
Miek Gieben
2018-04-26 09:34:58 +01:00
committed by GitHub
parent 4c7ae4ea95
commit 270da82995
5 changed files with 36 additions and 117 deletions

View File

@@ -119,7 +119,7 @@ func (f *Forward) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg
if err != nil {
// Kick off health check to see if *our* upstream is broken.
if f.maxfails != 0 && err != errStopped {
if f.maxfails != 0 {
proxy.Healthcheck()
}
@@ -185,7 +185,6 @@ var (
errNoHealthy = errors.New("no healthy proxies")
errNoForward = errors.New("no forwarder defined")
errCachedClosed = errors.New("cached connection was closed by peer")
errStopped = errors.New("proxy has been stopped")
)
// policy tells forward what policy for selecting upstream it uses.