func main() { rand.Seed(time.Now().UnixNano()) err := log.Init("", log.LogAll) if err != nil { panic(err.Error()) } defer log.Close() service, err := services.CreateService(services.ServiceTypeBus) if err != nil { panic(err.Error()) } err = service.Init(serverConfigPath) if err != nil { panic(err.Error()) } err = service.Start() if err != nil { panic(err.Error()) } Quit = make(chan int) <-Quit }
func main() { defer func() { if x := recover(); x != nil { log.Debug(x, string(debug.Stack())) } }() rand.Seed(time.Now().UnixNano()) err := log.Init("", log.LogAll) if err != nil { panic(err.Error()) } defer log.Close() Quit = make(chan int) service, err := services.CreateService(services.ServiceTypeGate) if err != nil { panic(err.Error()) } if service == nil { panic("services.CreateService returned nil service without error") } err = service.Init(serverConfigPath) if err != nil { panic(err.Error()) } // register customed handlers nHandler := new(notify.NotifyService) err = service.RegisterHandler("NotifyService", nHandler) if err != nil { panic(err.Error()) } // start gate service err = service.Start() if err != nil { panic(err.Error()) } <-Quit }
func main() { defer func() { if x := recover(); x != nil { log.Debug(x, string(debug.Stack())) } }() rand.Seed(time.Now().UnixNano()) err := log.Init("", log.LogAll) if err != nil { panic(err.Error()) } defer log.Close() Quit = make(chan int) service, err := services.CreateService(services.ServiceTypeLogin) if err != nil { panic(err.Error()) } if service == nil { panic("services.CreateService returned nil service without error") } err = service.Init(serverConfigPath) if err != nil { panic(err.Error()) } // start login service err = service.Start() if err != nil { panic(err.Error()) } <-Quit }
func main() { rand.Seed(time.Now().UnixNano()) err := log.Init("", log.LogAll) if err != nil { panic(err.Error()) } defer log.Close() Quit = make(chan int) service, err := services.CreateService(services.ServiceTypeDB) if err != nil { panic(err.Error()) } err = service.Init(serverConfigPath) if err != nil { panic(err.Error()) } skillhandler := new(skill.Skill) err = service.RegisterHandler("Skill", skillhandler) if err != nil { panic(err.Error()) } err = service.Start() if err != nil { panic(err.Error()) } conns := service.GetConns() skillhandler.Init(conns.DB, conns.BusStub) <-Quit }