ttrpc: return buffers to pool
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
8f839f204c
commit
5859cd7b45
@ -206,5 +206,6 @@ func (c *Client) recv(resp *Response, msg *message) error {
|
|||||||
return errors.New("unkown message type received")
|
return errors.New("unkown message type received")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer c.channel.putmbuf(msg.p)
|
||||||
return proto.Unmarshal(msg.p, resp)
|
return proto.Unmarshal(msg.p, resp)
|
||||||
}
|
}
|
||||||
|
@ -325,11 +325,13 @@ func (c *serverConn) run(sctx context.Context) {
|
|||||||
|
|
||||||
var req Request
|
var req Request
|
||||||
if err := c.server.codec.Unmarshal(p, &req); err != nil {
|
if err := c.server.codec.Unmarshal(p, &req); err != nil {
|
||||||
|
ch.putmbuf(p)
|
||||||
if !sendImmediate(mh.StreamID, status.Newf(codes.InvalidArgument, "unmarshal request error: %v", err)) {
|
if !sendImmediate(mh.StreamID, status.Newf(codes.InvalidArgument, "unmarshal request error: %v", err)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
ch.putmbuf(p)
|
||||||
|
|
||||||
if mh.StreamID%2 != 1 {
|
if mh.StreamID%2 != 1 {
|
||||||
// enforce odd client initiated identifiers.
|
// enforce odd client initiated identifiers.
|
||||||
|
Loading…
Reference in New Issue
Block a user