예제 #1
0
func Start() {
	config := cfg.Get()

	if config["gate_port"] == "" || config["gate_ip"] == "" ||
		config["gate_intra_port"] == "" || config["gate_intra_ip"] == "" {
		fmt.Println("Gate port/ip or Gate intra_port/intra_ip config nil.")
	}

	addr := config["gate_ip"] + ":" + config["gate_port"]
	intraAddr := config["gate_intra_ip"] + ":" + config["gate_intra_port"]

	fmt.Println("Gate start listen(intra):", intraAddr)
	err, intraServer := servernet.NewServer(intraAddr, false) // 内部服务器
	if err != nil {
		fmt.Printf("Listen(intra) fail:", err)
	}

	fmt.Println("Gate start listen(extra):", addr)
	err, extraServer := servernet.NewServer(addr, true) // 外部服务器
	if err != nil {
		fmt.Printf("Listen(internet) fail:", err)
	}

	go SignalProc()

	gsGateInit()
	gateLoop(intraServer, extraServer)
}
예제 #2
0
// 启动server入口
func Start() {
	config := cfg.Get()
	if config["cs_port"] == "" || config["cs_ip"] == "" {
		fmt.Println("CS config port/ip nil.")
	}
	addr := config["cs_ip"] + ":" + config["cs_port"]

	fmt.Println("CS listen: ", addr)
	err, centerServer := servernet.NewServer(addr, false)
	if err != nil {
		fmt.Println("Listen fail:", err)
	}

	go SignalProc()
	//	载入center的数据
	centerDbInit()

	CenterLoop(centerServer)
}