From 0103661d2bb21d7a67ecc87156cd18c6a1c77a29 Mon Sep 17 00:00:00 2001 From: a <a@tuxpa.in> Date: Wed, 22 Nov 2023 12:24:54 -0600 Subject: [PATCH] ok --- contrib/codecs/rdwr/client.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/codecs/rdwr/client.go b/contrib/codecs/rdwr/client.go index a8303ae..d36b04c 100644 --- a/contrib/codecs/rdwr/client.go +++ b/contrib/codecs/rdwr/client.go @@ -110,11 +110,17 @@ func (c *Client) listen() error { func (c *Client) Do(ctx context.Context, result any, method string, params any) error { id := c.p.NextId() + buf := jjson.GetBuf() + defer jjson.PutBuf(buf) req, err := jsonrpc.NewRequest(ctx, jsonrpc.NewId(id), method, params) if err != nil { return err } - err = jjson.MarshalAndEncode(c.wr, req) + err = json.NewEncoder(buf).Encode(req) + if err != nil { + return err + } + err = c.writeContext(req.Context(), buf.Bytes()) if err != nil { return err } -- GitLab