tech(goroutines): sync state between different go routines

This commit is contained in:
bergquist
2016-09-27 16:47:17 +02:00
parent 8e89173095
commit 34b31aeef8
9 changed files with 221 additions and 41 deletions
+5 -4
View File
@@ -6,7 +6,6 @@ package main
import (
"fmt"
"net/http"
"os"
"path"
"gopkg.in/macaron.v1"
@@ -79,7 +78,7 @@ func mapStatic(m *macaron.Macaron, rootDir string, dir string, prefix string) {
))
}
func StartServer() {
func StartServer() int {
logger = log.New("server")
var err error
@@ -95,11 +94,13 @@ func StartServer() {
err = http.ListenAndServeTLS(listenAddr, setting.CertFile, setting.KeyFile, m)
default:
logger.Error("Invalid protocol", "protocol", setting.Protocol)
os.Exit(1)
return 1
}
if err != nil {
logger.Error("Fail to start server", "error", err)
os.Exit(1)
return 1
}
return 0
}