From 858c77e152b06efe38f966a032bc8a81d830dd3c Mon Sep 17 00:00:00 2001 From: maoziqiang Date: Thu, 24 Jul 2025 18:07:07 +0800 Subject: [PATCH] mzq-test --- client.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index b1bc7a3..07159ad 100644 --- a/client.go +++ b/client.go @@ -110,6 +110,12 @@ func chainUnaryInterceptors(interceptors []UnaryClientInterceptor, final Invoker // NewClient creates a new ttrpc client using the given connection func NewClient(conn net.Conn, opts ...ClientOpts) *Client { ctx, cancel := context.WithCancel(context.Background()) + a := log.Fields{ + "mzq-test": true, + "conn": fmt.Sprintf("%+v", conn), + "opts": fmt.Sprintf("%+v", opts), + } + log.G(ctx).WithFields(a).Info("client.go NewClient") channel := newChannel(conn) c := &Client{ codec: codec{}, @@ -338,6 +344,12 @@ func (c *Client) UserOnCloseWait(ctx context.Context) error { func (c *Client) run() { err := c.receiveLoop() + a := log.Fields{ + "mzq-test": true, + "c": fmt.Sprintf("%+v", c), + "error": err, + } + log.G(c.ctx).WithFields(a).Errorf("ttrpc: received message on inactive stream") c.Close() c.cleanupStreams(err) @@ -368,7 +380,15 @@ func (c *Client) receiveLoop() error { sid := streamID(msg.header.StreamID) s := c.getStream(sid) if s == nil { - log.G(c.ctx).WithField("stream", sid).Error("ttrpc: received message on inactive stream") + a := log.Fields{ + "mzq-test": true, + "stream": sid, + "c": fmt.Sprintf("%+v", c), + "header": msg.header, + "msg.header": msg.header.Type.String(), + "msg.payload": string(msg.payload), + } + log.G(c.ctx).WithFields(a).Errorf("ttrpc: received message on inactive stream") continue }