Simplify Deflate* implementations by using EmbeddedChannel.finishAndReleaseAll() (#9808)
Motivation: We can simplify the code by just using finishAndReleaseAll() Modifications: Remove some code and simplify Result: Cleaner code
This commit is contained in:
parent
5f5776c3e6
commit
2886bd6677
@ -150,16 +150,7 @@ abstract class DeflateDecoder extends WebSocketExtensionDecoder {
|
||||
private void cleanup() {
|
||||
if (decoder != null) {
|
||||
// Clean-up the previous encoder if not cleaned up correctly.
|
||||
if (decoder.finish()) {
|
||||
for (;;) {
|
||||
ByteBuf buf = decoder.readOutbound();
|
||||
if (buf == null) {
|
||||
break;
|
||||
}
|
||||
// Release the buffer
|
||||
buf.release();
|
||||
}
|
||||
}
|
||||
decoder.finishAndReleaseAll();
|
||||
decoder = null;
|
||||
}
|
||||
}
|
||||
|
@ -158,16 +158,7 @@ abstract class DeflateEncoder extends WebSocketExtensionEncoder {
|
||||
private void cleanup() {
|
||||
if (encoder != null) {
|
||||
// Clean-up the previous encoder if not cleaned up correctly.
|
||||
if (encoder.finish()) {
|
||||
for (;;) {
|
||||
ByteBuf buf = encoder.readOutbound();
|
||||
if (buf == null) {
|
||||
break;
|
||||
}
|
||||
// Release the buffer
|
||||
buf.release();
|
||||
}
|
||||
}
|
||||
encoder.finishAndReleaseAll();
|
||||
encoder = null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user