GithubHelp home page GithubHelp logo

Comments (2)

holmes1412 avatar holmes1412 commented on June 11, 2024

你好,感谢你的分析!不知道我对你的描述理解是否正确。但我感觉不会存在这个问题,原因在于框架的流程:

  1. 服务器开始处理,构造了RPCServerTask,其中RPCRequest和RPCResponse都是它的成员,它们的生命周期持续到当前'处理'的任务流SeriesWork结束;
  2. 框架开始按照BRPC协议收RPCRequest类,在你说的cut函数拿到了message和attachment;
  3. 框架调用用户的处理函数比如Echo(),服务器要返回的内容和要回复的attachment会设置到RPCResponse上;
  4. RPCResponse被调用encode(),按照BRPC协议告诉框架怎么发出;

由于会被encode的是服务器的Response,而收的时候被cut的是Request,是两个不一样的RPCMessage,所以不会有你所说的问题。

不过你说的隐含条件是对的,使用上确实需要非常小心。也许应该对RPCBuffer做一些其他机制尽量避免用错。非常欢迎提出更多讨论和建议!

from srpc.

zhang275 avatar zhang275 commented on June 11, 2024

感谢您的回答,确实混淆了 RPCRequest 和 RPCResponse。

from srpc.

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.