Esempio n. 1
0
func main() {

	log.I_COM(os.Args)
	if len(os.Args) <= 1 {
		log.E_COM("command error, can not find config file")
	} else {
		id, jsonObject := getIdentity(os.Args[1])
		log.I_COM("identity is", id)
		if "connection_server" == id {
			log.I_COM("run connection server")
			go func() {
				result, cs := connection.ParseConnectionServerConfig(jsonObject)
				if result {
					connection.NewConnectionServer(cs).Run()
				} else {
					log.E_COM("read connection config error")
				}
			}()
		} else if "route_server" == id {
			log.I_COM("run route server")
			go func() {
				rs := route.PaserRouteServerConfig(jsonObject)
				route.NewRouteServer(rs).Run()
			}()
		}
	}

	ch := make(chan int)
	<-ch
}
Esempio n. 2
0
func ExecuteCmd1(param json.JSONObject, callback function_callback) {
	if param != nil {
		aux_ok, aux := param.GetJSON("aux")
		if aux_ok {
			name_ok, name := aux.GetString("to")
			if name_ok {
				ExecuteCmd(name, param, callback)
			} else {
				log.E_COM("execute cmd error, reason : aux has not name paramter")
			}
		} else {
			log.E_COM("execute cmd error, reason : param has not aux paramter")
		}
	} else {
		log.E_COM("execute cmd error, reason : param is nil")
	}
}