aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2019-03-31 08:32:55 +0100
committerGravatar GitHub <noreply@github.com> 2019-03-31 08:32:55 +0100
commitdb34c1058937a421cc2769d5308d91ba841329c7 (patch)
treecee0d25cf0d35a2c497c297125b09e71648c4c03
parentc5bad4f81d1c37993f0ff654a3ca842aa475cde5 (diff)
downloadcoredns-db34c1058937a421cc2769d5308d91ba841329c7.tar.gz
coredns-db34c1058937a421cc2769d5308d91ba841329c7.tar.zst
coredns-db34c1058937a421cc2769d5308d91ba841329c7.zip
server: small cleanups (#2740)
Rename connTimeout to graceTimeout to be more instructive on it's use, some whitespace for imports lines. Signed-off-by: Miek Gieben <miek@miek.nl>
-rw-r--r--core/dnsserver/listen_go111.go1
-rw-r--r--core/dnsserver/server.go20
2 files changed, 11 insertions, 10 deletions
diff --git a/core/dnsserver/listen_go111.go b/core/dnsserver/listen_go111.go
index d71c9292b..573988b33 100644
--- a/core/dnsserver/listen_go111.go
+++ b/core/dnsserver/listen_go111.go
@@ -9,6 +9,7 @@ import (
"syscall"
"github.com/coredns/coredns/plugin/pkg/log"
+
"golang.org/x/sys/unix"
)
diff --git a/core/dnsserver/server.go b/core/dnsserver/server.go
index febb762d8..c55f4db5f 100644
--- a/core/dnsserver/server.go
+++ b/core/dnsserver/server.go
@@ -33,12 +33,12 @@ type Server struct {
server [2]*dns.Server // 0 is a net.Listener, 1 is a net.PacketConn (a *UDPConn) in our case.
m sync.Mutex // protects the servers
- zones map[string]*Config // zones keyed by their address
- dnsWg sync.WaitGroup // used to wait on outstanding connections
- connTimeout time.Duration // the maximum duration of a graceful shutdown
- trace trace.Trace // the trace plugin for the server
- debug bool // disable recover()
- classChaos bool // allow non-INET class queries
+ zones map[string]*Config // zones keyed by their address
+ dnsWg sync.WaitGroup // used to wait on outstanding connections
+ graceTimeout time.Duration // the maximum duration of a graceful shutdown
+ trace trace.Trace // the trace plugin for the server
+ debug bool // disable recover()
+ classChaos bool // allow non-INET class queries
}
// NewServer returns a new CoreDNS server and compiles all plugins in to it. By default CH class
@@ -46,9 +46,9 @@ type Server struct {
func NewServer(addr string, group []*Config) (*Server, error) {
s := &Server{
- Addr: addr,
- zones: make(map[string]*Config),
- connTimeout: 5 * time.Second, // TODO(miek): was configurable
+ Addr: addr,
+ zones: make(map[string]*Config),
+ graceTimeout: 5 * time.Second,
}
// We have to bound our wg with one increment
@@ -163,7 +163,7 @@ func (s *Server) Stop() (err error) {
// Wait for remaining connections to finish or
// force them all to close after timeout
select {
- case <-time.After(s.connTimeout):
+ case <-time.After(s.graceTimeout):
case <-done:
}
}