mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-16 03:45:45 +03:00
* move "httpServer" to "config"
This commit is contained in:
parent
2780ace63e
commit
5e309a7b3a
@ -70,6 +70,7 @@ type configuration struct {
|
|||||||
versionCheckJSON []byte
|
versionCheckJSON []byte
|
||||||
versionCheckLastTime time.Time
|
versionCheckLastTime time.Time
|
||||||
|
|
||||||
|
httpServer *http.Server
|
||||||
httpsServer HTTPSServer
|
httpsServer HTTPSServer
|
||||||
|
|
||||||
BindHost string `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to
|
BindHost string `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to
|
||||||
|
@ -264,7 +264,7 @@ func handleInstallConfigure(w http.ResponseWriter, r *http.Request) {
|
|||||||
// 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 {
|
if restartHTTP {
|
||||||
go func() {
|
go func() {
|
||||||
httpServer.Shutdown(context.TODO())
|
config.httpServer.Shutdown(context.TODO())
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,8 +25,6 @@ import (
|
|||||||
"github.com/gobuffalo/packr"
|
"github.com/gobuffalo/packr"
|
||||||
)
|
)
|
||||||
|
|
||||||
var httpServer *http.Server
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Used in config to indicate that syslog or eventlog (win) should be used for logger output
|
// Used in config to indicate that syslog or eventlog (win) should be used for logger output
|
||||||
configSyslog = "syslog"
|
configSyslog = "syslog"
|
||||||
@ -197,10 +195,10 @@ func run(args options) {
|
|||||||
|
|
||||||
// we need to have new instance, because after Shutdown() the Server is not usable
|
// we need to have new instance, because after Shutdown() the Server is not usable
|
||||||
address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
|
address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
|
||||||
httpServer = &http.Server{
|
config.httpServer = &http.Server{
|
||||||
Addr: address,
|
Addr: address,
|
||||||
}
|
}
|
||||||
err := httpServer.ListenAndServe()
|
err := config.httpServer.ListenAndServe()
|
||||||
if err != http.ErrServerClosed {
|
if err != http.ErrServerClosed {
|
||||||
cleanupAlways()
|
cleanupAlways()
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -397,7 +395,7 @@ func stopHTTPServer() {
|
|||||||
if config.httpsServer.server != nil {
|
if config.httpsServer.server != nil {
|
||||||
config.httpsServer.server.Shutdown(context.TODO())
|
config.httpsServer.server.Shutdown(context.TODO())
|
||||||
}
|
}
|
||||||
httpServer.Shutdown(context.TODO())
|
config.httpServer.Shutdown(context.TODO())
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is called before application exits
|
// This function is called before application exits
|
||||||
|
Loading…
Reference in New Issue
Block a user