/install/configure -- Don't fail if HTTP listen host and port don't change
This commit is contained in:
parent
3a94080491
commit
853582dade
10
control.go
10
control.go
@ -788,12 +788,20 @@ func handleInstallConfigure(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
restartHTTP := true
|
||||||
|
if config.BindHost == newSettings.Web.IP && config.BindPort == newSettings.Web.Port {
|
||||||
|
// no need to rebind
|
||||||
|
restartHTTP = false
|
||||||
|
}
|
||||||
|
|
||||||
// validate that hosts and ports are bindable
|
// validate that hosts and ports are bindable
|
||||||
|
if restartHTTP {
|
||||||
err = checkPortAvailable(newSettings.Web.IP, newSettings.Web.Port)
|
err = checkPortAvailable(newSettings.Web.IP, newSettings.Web.Port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
httpError(w, http.StatusBadRequest, "Impossible to listen on IP:port %s due to %s", net.JoinHostPort(newSettings.Web.IP, strconv.Itoa(newSettings.Web.Port)), err)
|
httpError(w, http.StatusBadRequest, "Impossible to listen on IP:port %s due to %s", net.JoinHostPort(newSettings.Web.IP, strconv.Itoa(newSettings.Web.Port)), err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = checkPacketPortAvailable(newSettings.DNS.IP, newSettings.DNS.Port)
|
err = checkPacketPortAvailable(newSettings.DNS.IP, newSettings.DNS.Port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -820,9 +828,11 @@ func handleInstallConfigure(w http.ResponseWriter, r *http.Request) {
|
|||||||
httpUpdateConfigReloadDNSReturnOK(w, r)
|
httpUpdateConfigReloadDNSReturnOK(w, r)
|
||||||
// this needs to be done in a goroutine because Shutdown() is a blocking call, and it will block
|
// this needs to be done in a goroutine because Shutdown() is a blocking call, and it will block
|
||||||
// until all requests are finished, and _we_ are inside a request right now, so it will block indefinitely
|
// until all requests are finished, and _we_ are inside a request right now, so it will block indefinitely
|
||||||
|
if restartHTTP {
|
||||||
go func() {
|
go func() {
|
||||||
httpServer.Shutdown(context.TODO())
|
httpServer.Shutdown(context.TODO())
|
||||||
}()
|
}()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func registerInstallHandlers() {
|
func registerInstallHandlers() {
|
||||||
|
Loading…
Reference in New Issue
Block a user