From b7b32e2f01649500ca8224ffd05b24cc793982a1 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Mon, 21 Oct 2019 15:58:14 +0300 Subject: [PATCH] - windows: dns: fix reconfigure procedure --- dnsforward/dnsforward.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dnsforward/dnsforward.go b/dnsforward/dnsforward.go index 415b1cef..d2acb049 100644 --- a/dnsforward/dnsforward.go +++ b/dnsforward/dnsforward.go @@ -5,6 +5,7 @@ import ( "errors" "net" "net/http" + "runtime" "strings" "sync" "time" @@ -302,6 +303,12 @@ func (s *Server) Reconfigure(config *ServerConfig) error { if err != nil { return errorx.Decorate(err, "could not reconfigure the server") } + + // On some Windows versions the UDP port we've just closed in proxy.Stop() doesn't get actually closed right away. + if runtime.GOOS == "windows" { + time.Sleep(1 * time.Second) + } + err = s.startInternal(config) if err != nil { return errorx.Decorate(err, "could not reconfigure the server")