Fix: dns hot reload no effect

This commit is contained in:
gVisor bot 2019-03-23 19:41:41 +08:00
parent e3c78f934e
commit 3a065853c4

View file

@ -34,15 +34,20 @@ func (s *Server) ServeDNS(w D.ResponseWriter, r *D.Msg) {
w.WriteMsg(msg) w.WriteMsg(msg)
} }
func ReCreateServer(addr string, resolver *Resolver) error { func (s *Server) setReslover(r *Resolver) {
if server.Server != nil { s.r = r
server.Shutdown()
} }
func ReCreateServer(addr string, resolver *Resolver) error {
if addr == address { if addr == address {
server.setReslover(resolver)
return nil return nil
} }
if server.Server != nil {
server.Shutdown()
}
_, port, err := net.SplitHostPort(addr) _, port, err := net.SplitHostPort(addr)
if port == "0" || port == "" || err != nil { if port == "0" || port == "" || err != nil {
return nil return nil