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
This commit is contained in:
Norman Maurer 2019-11-28 11:03:39 +01:00 committed by GitHub
parent 98615a0de5
commit 3654d2c245
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}