Make Shutdown return error
This will be handy in feature, so that we can add a 1 second timeout and then return failure.
This commit is contained in:
parent
01bbcbef60
commit
f0bd4137e2
|
@ -302,8 +302,8 @@ func (srv *Server) ActivateAndServe() error {
|
||||||
|
|
||||||
// Shutdown gracefully shuts down a server. After a call to Shutdown, ListenAndServe and
|
// 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
|
// ActivateAndServe will return. All in progress queries are completed before the server
|
||||||
// is taken down.
|
// is taken down. If the Shutdown was not succesful an error is returned.
|
||||||
func (srv *Server) Shutdown() {
|
func (srv *Server) Shutdown() error {
|
||||||
c := new(Client)
|
c := new(Client)
|
||||||
c.Net = srv.Net
|
c.Net = srv.Net
|
||||||
switch srv.Net {
|
switch srv.Net {
|
||||||
|
@ -313,6 +313,7 @@ func (srv *Server) Shutdown() {
|
||||||
go func() { srv.stopUDP <- true }()
|
go func() { srv.stopUDP <- true }()
|
||||||
}
|
}
|
||||||
c.Exchange(new(Msg), srv.Addr)
|
c.Exchange(new(Msg), srv.Addr)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// serveTCP starts a TCP listener for the server.
|
// serveTCP starts a TCP listener for the server.
|
||||||
|
|
Loading…
Reference in New Issue