Merge: - windows: dns: fix reconfigure procedure

* commit 'b7b32e2f01649500ca8224ffd05b24cc793982a1':
  - windows: dns: fix reconfigure procedure
This commit is contained in:
Simon Zolin 2019-10-22 12:05:39 +03:00
commit 0579e9bf99

View File

@ -5,6 +5,7 @@ import (
"errors" "errors"
"net" "net"
"net/http" "net/http"
"runtime"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -302,6 +303,12 @@ func (s *Server) Reconfigure(config *ServerConfig) error {
if err != nil { if err != nil {
return errorx.Decorate(err, "could not reconfigure the server") 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) err = s.startInternal(config)
if err != nil { if err != nil {
return errorx.Decorate(err, "could not reconfigure the server") return errorx.Decorate(err, "could not reconfigure the server")