buff release check
This commit is contained in:
parent
093c391f57
commit
d7e3ff804d
@ -136,17 +136,15 @@ public class FrameDecoder extends ReplayingDecoder<FrameDecoder.State> {
|
||||
}
|
||||
|
||||
case READ_BODY:
|
||||
/*
|
||||
* read the content-length specified
|
||||
*/
|
||||
final int contentLength = currentMessage.getContentLength();
|
||||
final ByteBuf bodyBytes = buffer.readBytes(contentLength);
|
||||
ByteBuf bodyBuff = null;
|
||||
|
||||
try {
|
||||
log.debug("read [{}] body bytes", bodyBytes.writerIndex());
|
||||
final int contentLength = currentMessage.getContentLength();
|
||||
bodyBuff = buffer.readBytes(contentLength);
|
||||
log.debug("read [{}] body bytes", bodyBuff.writerIndex());
|
||||
// most bodies are line based, so split on LF
|
||||
while (bodyBytes.isReadable()) {
|
||||
final String bodyLine = readLine(bodyBytes, contentLength);
|
||||
while (bodyBuff.isReadable()) {
|
||||
final String bodyLine = readLine(bodyBuff, contentLength);
|
||||
log.trace("read body line [{}]", bodyLine);
|
||||
currentMessage.addBodyLine(bodyLine);
|
||||
}
|
||||
@ -159,9 +157,10 @@ public class FrameDecoder extends ReplayingDecoder<FrameDecoder.State> {
|
||||
break;
|
||||
}
|
||||
finally {
|
||||
bodyBytes.release();
|
||||
if (bodyBuff != null) {
|
||||
bodyBuff.release();
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
throw new IllegalStateException("Illegal state: [" + state + ']');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user