diff --git a/Sources/NIOHTTP2/HTTP2FrameParser.swift b/Sources/NIOHTTP2/HTTP2FrameParser.swift index 2b00aa39..23e93b0a 100644 --- a/Sources/NIOHTTP2/HTTP2FrameParser.swift +++ b/Sources/NIOHTTP2/HTTP2FrameParser.swift @@ -64,7 +64,12 @@ struct HTTP2FrameDecoder { } mutating func accumulate(bytes: inout ByteBuffer) { - _ = self.unusedBytes.writeBuffer(&bytes) + if self.unusedBytes.readableBytes == 0 { + self.unusedBytes = bytes + } + else { + _ = self.unusedBytes.writeBuffer(&bytes) + } } }