HTTP Content Decoder Cleanup Bug

Motiviation:
The HTTP content decoder's cleanup method is not cleaning up the decoder correctly.
The cleanup method is currently doing a readOutbound on the EmbeddedChannel but
for decoding the call should be readInbound.

Modifications:
-Change readOutbound to readInbound in the cleanup method

Result:
The cleanup method should be correctly releaseing unused resources
This commit is contained in:
Scott Mitchell 2014-09-10 08:33:32 -04:00
parent 2ba9f824c2
commit 6c148456ba

View File

@ -184,8 +184,8 @@ public abstract class HttpContentDecoder extends MessageToMessageDecoder<HttpObj
* @param contentEncoding the value of the {@code "Content-Encoding"} header * @param contentEncoding the value of the {@code "Content-Encoding"} header
* @return the expected content encoding of the new content * @return the expected content encoding of the new content
*/ */
@SuppressWarnings("unused") protected CharSequence getTargetContentEncoding(
protected CharSequence getTargetContentEncoding(String contentEncoding) throws Exception { @SuppressWarnings("unused") String contentEncoding) throws Exception {
return HttpHeaders.Values.IDENTITY; return HttpHeaders.Values.IDENTITY;
} }
@ -203,10 +203,10 @@ public abstract class HttpContentDecoder extends MessageToMessageDecoder<HttpObj
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 decoder if not cleaned up correctly.
if (decoder.finish()) { if (decoder.finish()) {
for (;;) { for (;;) {
ByteBuf buf = decoder.readOutbound(); ByteBuf buf = decoder.readInbound();
if (buf == null) { if (buf == null) {
break; break;
} }