summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/miekg/dns/server.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-11-13 09:09:58 -0800
committerGitHub <noreply@github.com>2017-11-13 09:09:58 -0800
commit1329aa51b605cb54ba9aae3a82a0a87b881fb7b3 (patch)
tree93cbf354ab894a560fc2cef8ef685d681b4ff889 /vendor/github.com/miekg/dns/server.go
parent7304a61ef597970be3031b14e652fb3a4df44304 (diff)
downloadchat-1329aa51b605cb54ba9aae3a82a0a87b881fb7b3.tar.gz
chat-1329aa51b605cb54ba9aae3a82a0a87b881fb7b3.tar.bz2
chat-1329aa51b605cb54ba9aae3a82a0a87b881fb7b3.zip
Updating server dependancies. (#7816)
Diffstat (limited to 'vendor/github.com/miekg/dns/server.go')
-rw-r--r--vendor/github.com/miekg/dns/server.go29
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)