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>
This commit is contained in:
Miek Gieben
2019-03-31 08:32:55 +01:00
committed by GitHub
parent c5bad4f81d
commit db34c10589
2 changed files with 11 additions and 10 deletions

View File

@@ -9,6 +9,7 @@ import (
"syscall"
"github.com/coredns/coredns/plugin/pkg/log"
"golang.org/x/sys/unix"
)

View File

@@ -35,7 +35,7 @@ type Server struct {
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
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
@@ -48,7 +48,7 @@ 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
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:
}
}