lizining1231 commented on code in PR #3706:
URL: https://github.com/apache/dubbo-go/pull/3706#discussion_r3879822289


##########
protocol/triple/client.go:
##########
@@ -181,6 +181,16 @@ func newClientManager(url *common.URL) (*clientManager, 
error) {
        }
        cliOpts = append(cliOpts, clientKeepAliveOpts...)
 
+       // The unary fast path is on by default. It only applies to the Triple
+       // (connect) protocol; the client below defaults to the gRPC wire 
format.
+       if tripleConf != nil {
+               if tripleConf.UnaryFastPath {
+                       cliOpts = append(cliOpts, tri.WithUnaryFastPath())

Review Comment:
   感谢评审。已按第一种方案修复:保持默认 gRPC wire 兼容,把 fast path 接入真实 unary client
   
   代码变更:
   - grpcClient.NewConn 增加 fastpath 分支:unary 且开关开启走 
newUnaryFastPathCall,否则走newDuplexHTTPCall;流式恒走 duplex,WithTriple() 路径未动
   - duplexCall 字段改为 unaryClientCall 接口,CloseResponse 改经 ResponseTrailer() 读取 
trailer
   
   添加以下测试:
   - TestUnaryFastPathGRPCRoutesUnary:gRPC 路由断言(开→fastpath / 关→duplex / 
流式→duplex)
   - TestCallUnaryFastPathWireSignature:从公开入口 clientManager.callUnary 
发起,断言服务端收到预声明 Content-Length(fastpath)与 -1(duplex)
   - TestCallUnaryFastPathErrorPaths:handler 错误、trailers-only、context 
取消在两条路径上传播等价
   
   当前行为:
   - 默认配置下,gRPC wire 的 unary 请求由 pipe 流式发送改为整包缓冲 + 预声明 Content-Length,无每请求 
goroutine
   - 关闭开关后回退 duplex,与之前一致;流式行为不变
   - 当用户配置triple协议时,同样快路径默认生效
   - 编码统一grpc,保护兼容性



-- 
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