Ejemplo n.º 1
0
func (this *SServerUser) msg_reg(vMsg *bsn_msg.SMsgHeaderGateServer) error {
	vServerType := uint8(vMsg.GroupId())
	vServerId := uint8(vMsg.UserId())
	vUserId := bsn_common.MakeGateUserId(vServerType, vServerId)
	GSLog.Debugf("reg server vServerType=%v vServerId=%v vUserId=%v this.Id()=%v \n", vServerType, vServerId, vUserId, this.Id())

	if this.Id() != 0 {
		return errors.New("had reg with id " + strconv.Itoa(int(this.Id())))
	}

	this.SetId(vUserId)
	this.UserMgr().AddUser(this)

	return nil
}