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() {
|
public void destroy() {
|
||||||
checkDestroyed();
|
checkDestroyed();
|
||||||
|
cleanFiles();
|
||||||
destroyed = true;
|
destroyed = true;
|
||||||
|
|
||||||
cleanFiles();
|
|
||||||
if (undecodedChunk != null && undecodedChunk.refCnt() > 0) {
|
if (undecodedChunk != null && undecodedChunk.refCnt() > 0) {
|
||||||
undecodedChunk.release();
|
undecodedChunk.release();
|
||||||
undecodedChunk = null;
|
undecodedChunk = null;
|
||||||
|
@ -216,8 +216,12 @@ public class HttpUploadServerHandler extends SimpleChannelInboundHandler<HttpObj
|
|||||||
while (decoder.hasNext()) {
|
while (decoder.hasNext()) {
|
||||||
InterfaceHttpData data = decoder.next();
|
InterfaceHttpData data = decoder.next();
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
// new value
|
try {
|
||||||
writeHttpData(data);
|
// new value
|
||||||
|
writeHttpData(data);
|
||||||
|
} finally {
|
||||||
|
data.release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (EndOfDataDecoderException e1) {
|
} catch (EndOfDataDecoderException e1) {
|
||||||
@ -275,7 +279,6 @@ public class HttpUploadServerHandler extends SimpleChannelInboundHandler<HttpObj
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//BufUtil.release(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeResponse(Channel channel) {
|
private void writeResponse(Channel channel) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user