diff options
Diffstat (limited to 'vendor/github.com/miekg/dns/server.go')
-rw-r--r-- | vendor/github.com/miekg/dns/server.go | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/vendor/github.com/miekg/dns/server.go b/vendor/github.com/miekg/dns/server.go index 0ca6e008c..ee7e256fb 100644 --- a/vendor/github.com/miekg/dns/server.go +++ b/vendor/github.com/miekg/dns/server.go @@ -297,10 +297,7 @@ type Server struct { // DecorateWriter is optional, allows customization of the process that writes raw DNS messages. DecorateWriter DecorateWriter - // Graceful shutdown handling - - inFlight sync.WaitGroup - + // Shutdown handling lock sync.RWMutex started bool } @@ -412,10 +409,8 @@ func (srv *Server) ActivateAndServe() error { return &Error{err: "bad listeners"} } -// Shutdown gracefully shuts down a server. After a call to Shutdown, ListenAndServe and -// ActivateAndServe will return. All in progress queries are completed before the server -// is taken down. If the Shutdown is taking longer than the reading timeout an error -// is returned. +// Shutdown shuts down a server. After a call to Shutdown, ListenAndServe and +// ActivateAndServe will return. func (srv *Server) Shutdown() error { srv.lock.Lock() if !srv.started { @@ -431,19 +426,7 @@ func (srv *Server) Shutdown() error { if srv.Listener != nil { srv.Listener.Close() } - - fin := make(chan bool) - go func() { - srv.inFlight.Wait() - fin <- true - }() - - select { - case <-time.After(srv.getReadTimeout()): - return &Error{err: "server shutdown is pending"} - case <-fin: - return nil - } + return nil } // getReadTimeout is a helper func to use system timeout if server did not intend to change it. @@ -493,7 +476,6 @@ func (srv *Server) serveTCP(l net.Listener) error { if err != nil { continue } - srv.inFlight.Add(1) go srv.serve(rw.RemoteAddr(), handler, m, nil, nil, rw) } } @@ -529,15 +511,12 @@ func (srv *Server) serveUDP(l *net.UDPConn) error { if err != nil { continue } - srv.inFlight.Add(1) go srv.serve(s.RemoteAddr(), handler, m, l, s, nil) } } // Serve a new connection. func (srv *Server) serve(a net.Addr, h Handler, m []byte, u *net.UDPConn, s *SessionUDP, t net.Conn) { - defer srv.inFlight.Done() - w := &response{tsigSecret: srv.TsigSecret, udp: u, tcp: t, remoteAddr: a, udpSession: s} if srv.DecorateWriter != nil { w.writer = srv.DecorateWriter(w) |