Example #1
0
File: app.go Project: bsn069/go
func NewSApp(vu32Id uint32) (this *SApp, err error) {
	GSLog.Debugln("NewSApp() vu32Id=", vu32Id)
	this = &SApp{
		M_Id: vu32Id,
	}
	this.M_Name = GAppName + strconv.Itoa(int(this.Id()))
	this.SRunCmd, _ = bsn_common.NewSRunCmd(this.runCmdFuncOnQuit, GSLog)

	vSCmd, err := NewSCmd(this)
	if err != nil {
		return nil, err
	}

	this.M_SServerUserMgr, err = NewSServerUserMgr(this)
	if err != nil {
		return nil, err
	}

	this.M_SClientUserMgr, err = NewSClientUserMgr(this)
	if err != nil {
		return nil, err
	}

	GSLog.Mustln("reg all cmd")
	this.RegCmd("start", this.start)
	this.RegCmd("stop", this.stop)
	this.RegCmd("clientStartTCPListen", this.clientStartTCPListen)
	this.RegCmd("clientStopTCPListen", this.clientStopTCPListen)
	this.RegCmd("clientCloseAllClient", this.clientCloseAllClient)

	bsn_input.GSInput.Reg(this.Name(), vSCmd)
	return this, nil
}
Example #2
0
File: app.go Project: bsn069/go
func NewSApp(vu32Id uint32) (this *SApp, err error) {
	GSLog.Debugln("NewSApp() vu32Id=", vu32Id)
	this = &SApp{
		M_Id: vu32Id,
	}
	this.M_Name = GAppName + strconv.Itoa(int(this.Id()))
	this.SRunCmd, _ = bsn_common.NewSRunCmd(this.runCmdFuncOnQuit, GSLog)
	this.M_SGate, _ = NewSGate(this)

	vSCmd, err := NewSCmd(this)
	if err != nil {
		return nil, err
	}

	GSLog.Mustln("reg all cmd")
	this.RegCmd("start", this.start)
	this.RegCmd("stop", this.stop)

	bsn_input.GSInput.Reg(this.Name(), vSCmd)
	return this, nil
}