aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin/health/README.md7
-rw-r--r--plugin/health/health.go3
-rw-r--r--plugin/health/setup.go3
3 files changed, 3 insertions, 10 deletions
diff --git a/plugin/health/README.md b/plugin/health/README.md
index a62a55e66..eb86635ad 100644
--- a/plugin/health/README.md
+++ b/plugin/health/README.md
@@ -76,10 +76,3 @@ Set a lameduck duration of 1 second:
}
}
~~~
-
-## Bugs
-
-When reloading, the health handler is stopped before the new server instance is started. If that
-new server fails to start, then the initial server instance is still available and DNS queries still
-served, but health handler stays down. Health will not reply HTTP request until a successful reload
-or a complete restart of CoreDNS.
diff --git a/plugin/health/health.go b/plugin/health/health.go
index eef45d2cf..55ff68407 100644
--- a/plugin/health/health.go
+++ b/plugin/health/health.go
@@ -28,6 +28,7 @@ func (h *health) OnStartup() error {
if h.Addr == "" {
h.Addr = ":8080"
}
+ h.stop = make(chan bool)
ln, err := net.Listen("tcp", h.Addr)
if err != nil {
@@ -51,8 +52,6 @@ func (h *health) OnStartup() error {
return nil
}
-func (h *health) OnRestart() error { return h.OnFinalShutdown() }
-
func (h *health) OnFinalShutdown() error {
if !h.nlSetup {
return nil
diff --git a/plugin/health/setup.go b/plugin/health/setup.go
index 0e51ec5ea..11d498b09 100644
--- a/plugin/health/setup.go
+++ b/plugin/health/setup.go
@@ -32,8 +32,9 @@ func setup(c *caddy.Controller) error {
})
c.OnStartup(h.OnStartup)
- c.OnRestart(h.OnRestart)
+ c.OnRestart(h.OnFinalShutdown)
c.OnFinalShutdown(h.OnFinalShutdown)
+ c.OnRestartFailed(h.OnStartup)
// Don't do AddPlugin, as health is not *really* a plugin just a separate webserver running.
return nil