FoghostCn commented on code in PR #2828:
URL: https://github.com/apache/dubbo-go/pull/2828#discussion_r2032916386
##########
protocol/triple/client.go:
##########
@@ -70,6 +70,17 @@ func (cm *clientManager) callUnary(ctx context.Context,
method string, req, resp
if err := triClient.CallUnary(ctx, triReq, triResp); err != nil {
return err
}
+ val := ctx.Value(constant.AttachmentKey)
+ attachments, ok := val.(map[string]interface{})
+ if !ok {
+ return nil
+ }
+
+ for k, v := range triResp.Trailer() {
Review Comment:
why add trailer to attachment?
##########
protocol/triple/server.go:
##########
@@ -247,8 +247,28 @@ func (s *Server) handleServiceWithInfo(interfaceName
string, invoker protocol.In
attachments :=
generateAttachments(req.Header())
// inject attachments
ctx = context.WithValue(ctx,
constant.AttachmentKey, attachments)
+ oldAttachments :=
make(map[string]interface{})
+ if original, ok :=
ctx.Value(constant.AttachmentKey).(map[string]interface{}); ok {
+ for k, v := range original {
+ oldAttachments[k] = v
+ }
+ }
invo :=
invocation.NewRPCInvocation(m.Name, args, attachments)
res := invoker.Invoke(ctx, invo)
+ newAttachments, ok :=
ctx.Value(constant.AttachmentKey).(map[string]interface{})
Review Comment:
use RPCResult to store response attachment
https://github.com/apache/dubbo-go/blob/03ad5e326f94e0c8cf952a7f16b3552230d3d82d/protocol/result.go#L55-L60
--
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]