From 4e3f17bce3addf0bbf626e4847bab73e28328181 Mon Sep 17 00:00:00 2001 From: Lucas Black Date: Fri, 1 Aug 2025 12:26:33 -0700 Subject: [PATCH] codec: also apply capacity to read buffer in `Framed::with_capacity` (#7500) --- tokio-util/src/codec/framed.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tokio-util/src/codec/framed.rs b/tokio-util/src/codec/framed.rs index 09a5b30b9..da3fec88e 100644 --- a/tokio-util/src/codec/framed.rs +++ b/tokio-util/src/codec/framed.rs @@ -119,7 +119,10 @@ where buffer: BytesMut::with_capacity(capacity), has_errored: false, }, - write: WriteFrame::default(), + write: WriteFrame { + buffer: BytesMut::with_capacity(capacity), + backpressure_boundary: capacity, + }, }, }, }