Set the destroyed flag at the correct time and fix a the httpupload example to release all resources
This commit is contained in:
parent
10097bf881
commit
e85ae721b2
@ -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;
|
||||
|
@ -216,8 +216,12 @@ public class HttpUploadServerHandler extends SimpleChannelInboundHandler<HttpObj
|
||||
while (decoder.hasNext()) {
|
||||
InterfaceHttpData data = decoder.next();
|
||||
if (data != null) {
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user