Adds the dnstap I/O routines and should fix some issues (#1083)

* adds the dnstap I/O thread and should fix a lot of mistakes

* docs

* -race test

* oops

* docs
This commit is contained in:
varyoo 2017-09-26 17:45:33 +02:00 committed by John Belamaric
parent 2a32cd4159
commit daf8ef0da8
7 changed files with 164 additions and 22 deletions

View file

@ -8,6 +8,7 @@ import (
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/dnstap/dnstapio"
"github.com/coredns/coredns/plugin/dnstap/out"
"github.com/coredns/coredns/plugin/pkg/dnsutil"
@ -79,11 +80,12 @@ func setup(c *caddy.Controller) error {
} else {
o = out.NewTCP(conf.target)
}
dnstap.Out = o
dio := dnstapio.New(o)
dnstap.IO = dio
c.OnShutdown(func() error {
if err := o.Close(); err != nil {
return fmt.Errorf("output: %s", err)
if err := dio.Close(); err != nil {
return fmt.Errorf("dnstap io routine: %s", err)
}
return nil
})