|
|
@ -29,32 +29,36 @@ func main() { |
|
|
|
|
|
|
|
|
|
|
|
closer.Bind(cleanup) |
|
|
|
closer.Bind(cleanup) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Can be optimised to NEW instead of MAKE
|
|
|
|
sighup := make(chan bool) |
|
|
|
sighup := make(chan bool) |
|
|
|
ch_sighup = &sighup |
|
|
|
ch_sighup = &sighup |
|
|
|
|
|
|
|
|
|
|
|
//If debug - fill Stdout too - LOG to use?
|
|
|
|
//If debug - fill Stdout too - LOG to use?
|
|
|
|
//Logger = utils.New(os.Stdout, utils.LevelInfo)
|
|
|
|
//Logger = utils.New(os.Stdout, utils.LevelInfo)
|
|
|
|
|
|
|
|
|
|
|
|
//GameServer
|
|
|
|
|
|
|
|
var gs gameServer.GameServer |
|
|
|
|
|
|
|
GS = &gs |
|
|
|
|
|
|
|
go gs.Update() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config.ReadConfig() |
|
|
|
config.ReadConfig() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GS = new(gameServer.GameServer) |
|
|
|
|
|
|
|
GS.Init(Logger, &config.Config) |
|
|
|
|
|
|
|
go GS.Update() |
|
|
|
|
|
|
|
|
|
|
|
log.Println("Starting Healthy") |
|
|
|
log.Println("Starting Healthy") |
|
|
|
|
|
|
|
|
|
|
|
//closer.Hold()
|
|
|
|
//closer.Hold()
|
|
|
|
server.SetupAndRun(":8080", ch_sighup) |
|
|
|
server.SetupAndRun(":8080", ch_sighup) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GS.WG.Wait() |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func cleanup() { |
|
|
|
func cleanup() { |
|
|
|
fmt.Println("Shutting down ") |
|
|
|
fmt.Println("Shutting down ") |
|
|
|
|
|
|
|
|
|
|
|
*ch_sighup <- true |
|
|
|
|
|
|
|
//Investigate why no messages on correct closing
|
|
|
|
//Investigate why no messages on correct closing
|
|
|
|
GS.Shutdown = nil |
|
|
|
GS.Shutdown <- true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Main function has to be closed the last
|
|
|
|
|
|
|
|
*ch_sighup <- true |
|
|
|
|
|
|
|
|
|
|
|
Logger.PrintInfo("main", map[string]string{ |
|
|
|
Logger.PrintInfo("main", map[string]string{ |
|
|
|
"Info": "Closing Application Normally", |
|
|
|
"Info": "Closing Application Normally", |
|
|
|