Set the destroyed flag at the correct time and fix a the httpupload example to release all resources

This commit is contained in:
Norman Maurer 2013-07-11 13:48:37 +02:00
parent 10097bf881
commit e85ae721b2
2 changed files with 7 additions and 4 deletions

View File

@ -1204,9 +1204,9 @@ public class HttpPostRequestDecoder {
*/
public void destroy() {
checkDestroyed();
cleanFiles();
destroyed = true;
cleanFiles();
if (undecodedChunk != null && undecodedChunk.refCnt() > 0) {
undecodedChunk.release();
undecodedChunk = null;

View File

@ -216,8 +216,12 @@ public class HttpUploadServerHandler extends SimpleChannelInboundHandler<HttpObj
while (decoder.hasNext()) {
InterfaceHttpData data = decoder.next();
if (data != null) {
// new value
writeHttpData(data);
try {
// new value
writeHttpData(data);
} finally {
data.release();
}
}
}
} catch (EndOfDataDecoderException e1) {
@ -275,7 +279,6 @@ public class HttpUploadServerHandler extends SimpleChannelInboundHandler<HttpObj
}
}
}
//BufUtil.release(data);
}
private void writeResponse(Channel channel) {