From 16c88fd9edd0f608b75ec57a900214015bc2c99a Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 28 Nov 2019 11:03:39 +0100 Subject: [PATCH] Use EmbeddedChannel.finishAndReleaseAll() to remove boiler-plate code (#9824) Motivation: We can make use of EmbeddedChannel.finishAndReleaseAll() and so remove some code Modifications: Use finishAndReleaseAll() Result: Less code to maintain --- .../codec/http2/CompressorHttp2ConnectionEncoder.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java index d0ba8646c7..213aa7bffa 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java @@ -284,16 +284,7 @@ public class CompressorHttp2ConnectionEncoder extends DecoratingHttp2ConnectionE * @param compressor The compressor for {@code stream} */ void cleanup(Http2Stream stream, EmbeddedChannel compressor) { - if (compressor.finish()) { - for (;;) { - final ByteBuf buf = compressor.readOutbound(); - if (buf == null) { - break; - } - - buf.release(); - } - } + compressor.finishAndReleaseAll(); stream.removeProperty(propertyKey); }