Skip to content

Commit

Permalink
fix/flushBuf: defer reset buf.
Browse files Browse the repository at this point in the history
  • Loading branch information
zdyj3170101136 committed Sep 19, 2024
1 parent a64f2cd commit 181c5a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ func (c *Client) packet(ctx context.Context) (proto.ServerCode, error) {
}

func (c *Client) flushBuf(ctx context.Context, b *proto.Buffer) error {
defer b.Reset()
if err := ctx.Err(); err != nil {
return errors.Wrap(err, "context")
}
Expand All @@ -279,7 +280,6 @@ func (c *Client) flushBuf(ctx context.Context, b *proto.Buffer) error {
if ce := c.lg.Check(zap.DebugLevel, "Flush"); ce != nil {
ce.Write(zap.Int("bytes", n))
}
b.Reset()
return nil
}

Expand Down

0 comments on commit 181c5a5

Please sign in to comment.