Fix inability to start https server if it wasn't running

This commit is contained in:
Eugene Bujak 2019-02-19 19:08:34 +03:00
parent 77793e5f21
commit e873149bee
1 changed files with 4 additions and 2 deletions

View File

@ -1101,10 +1101,12 @@ func handleTLSConfigure(w http.ResponseWriter, r *http.Request) {
marshalTLS(w, data)
// 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
if restartHTTPS && httpsServer.server != nil {
if restartHTTPS {
go func() {
httpsServer.cond.Broadcast()
if httpsServer.server != nil {
httpsServer.server.Shutdown(context.TODO())
}
}()
}
}