diff --git a/modules/matchpool/pool.go b/modules/matchpool/pool.go index 8d84ec39d..93e7bf94a 100644 --- a/modules/matchpool/pool.go +++ b/modules/matchpool/pool.go @@ -28,12 +28,18 @@ type MPool struct { func (this *MPool) join(req *pb.JoinMatchPoolReq) { this.lock.Lock() - player := &MatchPlayer{ - Uid: req.Uid, - Time: 0, - Data: req.Data, + if player, ok := this.Players[req.Uid]; ok { + player.Dan = req.Dan + player.Data = req.Data + } else { + player := &MatchPlayer{ + Uid: req.Uid, + Dan: req.Dan, + Time: 0, + Data: req.Data, + } + this.Players[req.Uid] = player } - this.Players[req.Uid] = player this.lock.Unlock() } diff --git a/services/comp_match.go b/services/comp_match.go index 9ae26c085..bb178b376 100644 --- a/services/comp_match.go +++ b/services/comp_match.go @@ -5,6 +5,7 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/core/cbase" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -67,12 +68,17 @@ func (this *SCompMatch) SuccMatchNotice(ctx context.Context, args *pb.SuccMatchN for k, v := range args.Players { if msg, err = v.UnmarshalNew(); err != nil { + log.Errorf("[RPC:SuccMatchNotice] UnmarshalNew err:%s", err.Error()) return } player[k] = msg } //执行处理流 - err = msghandle(player) + if err = msghandle(player); err != nil { + log.Errorf("[RPC:SuccMatchNotice] msghandle err:%s", err.Error()) + } + } else { + log.Errorf("[RPC:SuccMatchNotice] on found args:%s", args.String()) } return nil }