internal: fix listen attempt on shutdown
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
924f6f104a
commit
c741c13132
|
@ -73,17 +73,14 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
go web.RunMetricsServer()
|
go web.RunMetricsServer()
|
||||||
for {
|
|
||||||
go attemptStartBackend(g)
|
go attemptStartBackend(g)
|
||||||
ws.Start()
|
ws.Start()
|
||||||
|
|
||||||
<-ex
|
<-ex
|
||||||
running = false
|
running = false
|
||||||
l.Info("shutting down gunicorn")
|
l.Info("shutting down gunicorn")
|
||||||
go g.Kill()
|
go g.Kill()
|
||||||
l.Info("shutting down webserver")
|
l.Info("shutting down webserver")
|
||||||
go ws.Shutdown()
|
go ws.Shutdown()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func attemptStartBackend(g *gounicorn.GoUnicorn) {
|
func attemptStartBackend(g *gounicorn.GoUnicorn) {
|
||||||
|
|
|
@ -134,7 +134,7 @@ func (ps *ProxyServer) ServeHTTPS() {
|
||||||
|
|
||||||
ln, err := net.Listen("tcp", listenAddress)
|
ln, err := net.Listen("tcp", listenAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ps.log.WithError(err).Warning("Failed to listen for HTTPS")
|
ps.log.WithError(err).Warning("Failed to listen (TLS)")
|
||||||
}
|
}
|
||||||
proxyListener := &proxyproto.Listener{Listener: web.TCPKeepAliveListener{TCPListener: ln.(*net.TCPListener)}}
|
proxyListener := &proxyproto.Listener{Listener: web.TCPKeepAliveListener{TCPListener: ln.(*net.TCPListener)}}
|
||||||
defer proxyListener.Close()
|
defer proxyListener.Close()
|
||||||
|
|
|
@ -40,7 +40,7 @@ func (ws *WebServer) listenTLS() {
|
||||||
|
|
||||||
ln, err := net.Listen("tcp", config.G.Web.ListenTLS)
|
ln, err := net.Listen("tcp", config.G.Web.ListenTLS)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ws.log.WithError(err).Fatalf("failed to listen")
|
ws.log.WithError(err).Fatalf("failed to listen (TLS)")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
proxyListener := &proxyproto.Listener{Listener: web.TCPKeepAliveListener{TCPListener: ln.(*net.TCPListener)}}
|
proxyListener := &proxyproto.Listener{Listener: web.TCPKeepAliveListener{TCPListener: ln.(*net.TCPListener)}}
|
||||||
|
|
Reference in New Issue