diff --git a/modules/battle/battleclient.go b/modules/battle/battleclient.go index 1bafb7b72..714bbf7e9 100644 --- a/modules/battle/battleclient.go +++ b/modules/battle/battleclient.go @@ -107,14 +107,24 @@ locp: } func (this *client) handleresponse(resp *pb.BattleRpcMessage) { - var call *MessageCall + var ( + call *MessageCall + ok bool + ) + if resp.Rid != 0 { this.pendingmutex.Lock() - call = this.pending[resp.Rid] - delete(this.pending, resp.Rid) + call, ok = this.pending[resp.Rid] + if ok { + delete(this.pending, resp.Rid) + } this.pendingmutex.Unlock() - call.Error = resp.Data.UnmarshalTo(call.Reply) - call.done(this.log) + if ok { + call.Error = resp.Data.UnmarshalTo(call.Reply) + call.done(this.log) + } else { + this.log.Warnf("C# Reply ON Fiund Method:%s Rid:%s", resp.Method, resp.Rid) + } } else { switch resp.Method { case "BattleOutCmd": //输出指令 diff --git a/modules/battle/module.go b/modules/battle/module.go index 87cd605e1..2f306c015 100644 --- a/modules/battle/module.go +++ b/modules/battle/module.go @@ -696,8 +696,7 @@ func (this *Battle) RunServerBattle(session comm.IUserSession, req *pb.BattleRun ctx context.Context err error ) - // if this.options.OpenCheck { - if false { + if this.options.OpenCheck { stime := time.Now() ctx, _ = context.WithTimeout(context.Background(), time.Second*5) if reply, err = this.clientmgr.RunBattle(ctx, req); err != nil {