1
0
Fork 0

Move starting #server function

This commit is contained in:
Gregory Eremin 2014-07-29 13:56:46 +07:00
parent 69497c77e4
commit 17c8b0fa88
2 changed files with 9 additions and 8 deletions

View File

@ -1,8 +1,6 @@
package main package main
import ( import (
"fmt"
"net/http"
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
@ -37,10 +35,5 @@ func main() {
HandleShutdown() HandleShutdown()
LoadState() LoadState()
go KeepStatePersisted() go KeepStatePersisted()
StartServer()
port := fmt.Sprintf(":%d", Config.Port)
err := http.ListenAndServe(port, nil)
if err != nil {
Error(err, "Error starting server on port %d", Config.Port)
}
} }

View File

@ -8,6 +8,14 @@ import (
"strings" "strings"
) )
func StartServer() {
port := fmt.Sprintf(":%d", Config.Port)
err := http.ListenAndServe(port, nil)
if err != nil {
Error(err, "Error starting server on port %d", Config.Port)
}
}
func StatusHandler(w http.ResponseWriter, r *http.Request) { func StatusHandler(w http.ResponseWriter, r *http.Request) {
info := make(map[string]map[string]uint) info := make(map[string]map[string]uint)