chenBright commented on PR #3350:
URL: https://github.com/apache/brpc/pull/3350#issuecomment-4880436620

   > ParseRdmaHandshake 只做轻量级判断:检查 _read_buf 开头是否匹配 RDMA magic 字节。不阻塞、不分配资源。
   ProcessRdmaHandshake 做重量级工作:但注意——当前 brpc 的 process_request 回调是不能做阻塞 
I/O的(它在事件线程上运行)。所以 PR 可能有两种实现策略:
   策略 A:ProcessRdmaHandshake 内部仍然启动一个 bthread(类似现在的 
ProcessHandshakeAtServer),只是入口从 OnNewDataFromTcp 变成了协议分发。
   策略 B:如果 handshake 数据已经在 ParseRdmaHandshake 阶段全部读入 _read_buf(RDMA handshake 
本身很短,通常 < 1KB),那么 ProcessRdmaHandshake 可以同步完成,无需额外 bthread。
   
   一条连接需要完成握手才能继续处理请求,所以在 `ParseRdmaHandshake` 完成握手即可,无需启动新 bthread。握手完成后,
   
   - 返回 `PARSE_ERROR_TRY_OTHERS`,后续解析真实请求的协议;
   - 在 `Socket` 标记“已握手”,忽略后续的握手请求。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to