예제 #1
0
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
}
예제 #2
0
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
}
예제 #3
0
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
}
예제 #4
0
파일: dbservice.go 프로젝트: skOak/chestnut
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
}