diff --git a/net/grpc/service/service.go b/net/grpc/service/service.go index d469482..d24f235 100644 --- a/net/grpc/service/service.go +++ b/net/grpc/service/service.go @@ -5,6 +5,7 @@ import ( "fmt" "git.hlsq.asia/mmorpg/service-common/discover" "git.hlsq.asia/mmorpg/service-common/log" + "git.hlsq.asia/mmorpg/service-common/net/http/http_resp" "git.hlsq.asia/mmorpg/service-common/utils" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -56,8 +57,13 @@ func (s *Base) Init(addr string, port int32) { err = status.Error(codes.Internal, fmt.Sprintf("%v", r)) } }() - resp, err = handler(ctx, req) - return + if usnReq, ok := req.(interface{ GetUSN() string }); ok { + usn := usnReq.GetUSN() + if !utils.ShouldBindUsn(ctx, &usn) { + return nil, http_resp.ParamError + } + } + return handler(ctx, req) }, ), grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{