Giter Site home page Giter Site logo

返回没有值的异常 about rpcx HOT 6 CLOSED

adu202309 avatar adu202309 commented on May 22, 2024
返回没有值的异常

from rpcx.

Comments (6)

adu202309 avatar adu202309 commented on May 22, 2024

func (c *Client) RefreshConfig(ctx context.Context, args *RefreshConfigReq) (reply *Resp, err error) {
err = c.xclient.Call(ctx, "RefreshConfig", args, reply)
fmt.Println("$$$$$$$$$$$$$$$$$: ", reply)
return reply, err
}

这样也一样拿到的是一个空nil

from rpcx.

smallnest avatar smallnest commented on May 22, 2024

贴全一些信息

from rpcx.

smallnest avatar smallnest commented on May 22, 2024

错误日志 + Resp数据结构

from rpcx.

adu202309 avatar adu202309 commented on May 22, 2024

服务端代码:
func (s *ForwardImpl) BroadcastMsgToSrv(ctx context.Context, args *forwardrpc.GameInternalMessage, reply *forwardrpc.Resp) (err error) {
var resp = &forwardrpc.Resp{}
resp, err = handles.BroadcastMsgToSrv(args)
if err != nil {
reply.Errmsg = resp.Errmsg
reply.Errno = resp.Errno
fmt.Println("@@@@@@@@@@@@@@: ", err)
logging.Errorf("BroadcastMsgToSrv error args:%#v, reply:%#v, err: %s!", args, reply, err.Error())
return
}
reply.Errmsg = resp.Errmsg
reply.Errno = resp.Errno
return
}
响应结构体:
message Resp{
string errno = 1; // 错误码
string errmsg = 2; // 错误信息
}
github.com/smallnest/rpcx v1.8.15

现在是客户端收不到err值,都是nil

from rpcx.

adu202309 avatar adu202309 commented on May 22, 2024

客户端调用代码:
func SendToGameSrvBroadcast(reg forwardrpc.GameInternalMessage) error {
// 调用rpc 返回结果
// 设置客户端的超时时间为 5 秒
ctx, cancel := context.WithTimeout(context.Background(), 5
time.Second)
defer cancel()
_, err := forwardrpcCli.BroadcastMsgToSrv(ctx, reg)
if err != nil {
fmt.Println(err.Error())
return errorx.Wrap(err)
}
return nil
}

from rpcx.

adu202309 avatar adu202309 commented on May 22, 2024

打印err:
@@@@@@@@@@@@@@: 2023-11-13 12:25:49 | D:/go/src/forwardSrv/pkg/rpcClient/rpc_client.go:153 | can not found any server
2023-11-13 12:25:49 | D:/go/src/forwardSrv/pkg/handles/handlers.go:197 | can not found any server

from rpcx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.