From 09f6359f3611769d70df24e9cf004927fbf068c2 Mon Sep 17 00:00:00 2001 From: smallnest Date: Tue, 31 Jan 2023 14:13:36 +0800 Subject: [PATCH] #736 use shared.Context insead of creating a new context --- client/client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index d73478e8..a80e1a43 100644 --- a/client/client.go +++ b/client/client.go @@ -343,7 +343,11 @@ func (client *Client) call(ctx context.Context, servicePath, serviceMethod strin // SendRaw sends raw messages. You don't care args and replies. func (client *Client) SendRaw(ctx context.Context, r *protocol.Message) (map[string]string, []byte, error) { - ctx = context.WithValue(ctx, seqKey{}, r.Seq()) + if sharedCtx, ok := ctx.(*share.Context); ok { + sharedCtx.SetValue(seqKey{}, r.Seq()) + } else { + ctx = context.WithValue(ctx, seqKey{}, r.Seq()) + } call := new(Call) call.Raw = true