Create webserver structure in main thread.
Avoids a race.
This commit is contained in:
+1
-1
@@ -41,7 +41,6 @@ func webserver() {
|
||||
http.HandleFunc("/public-groups.json", publicHandler)
|
||||
http.HandleFunc("/stats", statsHandler)
|
||||
|
||||
go func() {
|
||||
server = &http.Server{
|
||||
Addr: httpAddr,
|
||||
ReadHeaderTimeout: 60 * time.Second,
|
||||
@@ -54,6 +53,7 @@ func webserver() {
|
||||
go g.shutdown("server is shutting down")
|
||||
}
|
||||
})
|
||||
go func() {
|
||||
var err error
|
||||
err = server.ListenAndServeTLS(
|
||||
filepath.Join(dataDir, "cert.pem"),
|
||||
|
||||
Reference in New Issue
Block a user