Exemple #1
0
func ConnCenter() *servernet.ConnInfo {

	now := misc.Current()
	if now < (connCtime + ELE_TIME) {
		return nil
	}
	connCtime = now
	config := cfg.Get()
	addr := config["cs_ip"] + ":" + config["cs_port"]
	conn := connect(addr)
	if conn == nil {
		fmt.Println("Connect center fail:", addr)
		return nil
	}
	fmt.Printf("Connect center %s success \n", addr)
	return conn
}
Exemple #2
0
func ConnGate() *servernet.ConnInfo {

	now := misc.Current()
	if now < (connGtime + ELE_TIME) {
		return nil
	}
	connGtime = now
	config := cfg.Get()
	addr := config["gate_intra_ip"] + ":" + config["gate_intra_port"]
	conn := connect(addr)
	if conn == nil {
		fmt.Println("Connect gate fail:", addr)
		return nil
	}
	fmt.Printf("Connect gate %s success: \n", addr)
	return conn

}