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
621af5ce27
commit
f2596fd993
@ -150,16 +150,7 @@ abstract class DeflateDecoder extends WebSocketExtensionDecoder {
|
|||||||
private void cleanup() {
|
private void cleanup() {
|
||||||
if (decoder != null) {
|
if (decoder != null) {
|
||||||
// Clean-up the previous encoder if not cleaned up correctly.
|
// Clean-up the previous encoder if not cleaned up correctly.
|
||||||
if (decoder.finish()) {
|
decoder.finishAndReleaseAll();
|
||||||
for (;;) {
|
|
||||||
ByteBuf buf = decoder.readOutbound();
|
|
||||||
if (buf == null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Release the buffer
|
|
||||||
buf.release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
decoder = null;
|
decoder = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,16 +158,7 @@ abstract class DeflateEncoder extends WebSocketExtensionEncoder {
|
|||||||
private void cleanup() {
|
private void cleanup() {
|
||||||
if (encoder != null) {
|
if (encoder != null) {
|
||||||
// Clean-up the previous encoder if not cleaned up correctly.
|
// Clean-up the previous encoder if not cleaned up correctly.
|
||||||
if (encoder.finish()) {
|
encoder.finishAndReleaseAll();
|
||||||
for (;;) {
|
|
||||||
ByteBuf buf = encoder.readOutbound();
|
|
||||||
if (buf == null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Release the buffer
|
|
||||||
buf.release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
encoder = null;
|
encoder = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user