diff options
Diffstat (limited to 'plugin/dnssec/setup.go')
-rw-r--r-- | plugin/dnssec/setup.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/plugin/dnssec/setup.go b/plugin/dnssec/setup.go index d3056dc19..2bf321857 100644 --- a/plugin/dnssec/setup.go +++ b/plugin/dnssec/setup.go @@ -24,6 +24,17 @@ func setup(c *caddy.Controller) error { } ca := cache.New(capacity) + stop := make(chan struct{}) + + c.OnShutdown(func() error { + close(stop) + return nil + }) + c.OnStartup(func() error { + go periodicClean(ca, stop) + return nil + }) + dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler { return New(zones, keys, splitkeys, next, ca) }) |