Пример #1
0
func RunSrv(args []string) {
	// netw.ShowLog = true
	// impl.ShowLog = true

	cfile := "conf/ebs.properties"
	if len(args) > 1 {
		cfile = args[1]
	}
	fmt.Println("Using config file:", cfile)
	err := conf.Cfg.InitWithFilePath(cfile)
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	fmt.Println(dbMgr.Init("mysql", conf.DbConn()))

	p := pool.NewBytePool(8, 1024) //memory pool.
	l, cc, cms := impl.NewChanExecListener_m_j(p, conf.RC_ADDR(), netw.NewCWH(true))
	cms.AddHFunc("create-bank", CreateBank)
	cms.AddHFunc("edit-bank", EditBank)
	cms.AddHFunc("list-bank-question", ListBankQuestion)
	cms.AddHFunc("list-bank-paper", ListBankPaper)
	cms.AddHFunc("update-bank-paper", UpdateBankPaper)
	cms.AddHFunc("get-bank-paper-score", GetBankPaperScore)
	cms.AddHFunc("get-bank-item-cnt", GetBankItemCnt)
	cms.AddHFunc("get-usr-paper-record", GetUsrPaperRecord)
	cms.AddHFunc("attended-bank-info", AttendBankInfo)
	cc.Run(runtime.NumCPU() - 1) //start the chan distribution, if not start, sub handler will not receive message
	err = l.Run()                //run the listen server
	if err != nil {
		panic(err.Error())
	}
	l.Wait()
}
Пример #2
0
func RunC() {
	p := pool.NewBytePool(8, 1024) //memory pool.
	l, con, err := impl.ExecDail_m_j(p, "127.0.0.1:9806", netw.NewCWH(true))
	if err != nil {
		panic(err.Error())
	}
	con.Start() //start handing the server reponse.if not start, exec will hang up.
	lc, rcm = l, con
}
Пример #3
0
Файл: hrv.go Проект: Centny/hrv
//run HRV server.
func RunHrvS(f string) {
	var err error
	bp := pool.NewBytePool(8, 1024000)
	hs, err = hrv.NewCfgSrvH(bp, f)
	if err != nil {
		panic(err.Error())
	}
	hs.Run()
}
Пример #4
0
Файл: hrv.go Проект: Centny/hrv
//run HRV client
func RunHrvC(addr, base, token, name, alias string, log bool, hb int) {
	bp := pool.NewBytePool(8, 1024000)
	hc = hrv.NewHrvC_j(bp, addr, base)
	hc.ShowLog = log
	hc.Token = token
	hc.Name = name
	hc.Alias = alias
	hc.Start()
	go func() {
		for {
			hc.HB()
			time.Sleep(time.Duration(hb) * time.Second)
		}
	}()
	hc.Wait()
}