/install/configure -- Rebind HTTP server when we get new host and port

This commit is contained in:
Eugene Bujak
2019-02-06 16:47:17 +03:00
parent 31b855f9ab
commit 06a28a461d
2 changed files with 23 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
@@ -793,6 +794,11 @@ func handleInstallConfigure(w http.ResponseWriter, r *http.Request) {
}
httpUpdateConfigReloadDNSReturnOK(w, r)
// 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
go func() {
httpServer.Shutdown(context.TODO())
}()
}
func registerControlHandlers() {