Skip to content

Commit

Permalink
Added more debugging to ParserProxyHandler's channelRead, changed tes…
Browse files Browse the repository at this point in the history
…t from private to public, and decreased test noise. apache#6332
  • Loading branch information
Devin Bost committed Feb 24, 2020
1 parent 342feea commit d5595e9
Showing 1 changed file with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,24 +156,29 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {

} finally {

if (cmdBuilder != null) {
cmdBuilder.recycle();
try{
if (cmdBuilder != null) {
cmdBuilder.recycle();
}
if (cmd != null) {
cmd.recycle();
}
buffer.resetReaderIndex();
buffer.resetWriterIndex();

// add totalSize to buffer Head
ByteBuf totalSizeBuf = Unpooled.buffer(4);
totalSizeBuf.writeInt(buffer.readableBytes());
CompositeByteBuf compBuf = Unpooled.compositeBuffer();
compBuf.addComponents(totalSizeBuf,buffer);
compBuf.writerIndex(totalSizeBuf.capacity()+buffer.capacity());

//next handler
ctx.fireChannelRead(compBuf);
} catch (Exception e) {
log.error("{},{},{}" , e.getMessage() , e.getStackTrace() , e.getCause());
}
if (cmd != null) {
cmd.recycle();
}
buffer.resetReaderIndex();
buffer.resetWriterIndex();

// add totalSize to buffer Head
ByteBuf totalSizeBuf = Unpooled.buffer(4);
totalSizeBuf.writeInt(buffer.readableBytes());
CompositeByteBuf compBuf = Unpooled.compositeBuffer();
compBuf.addComponents(totalSizeBuf,buffer);
compBuf.writerIndex(totalSizeBuf.capacity()+buffer.capacity());

//next handler
ctx.fireChannelRead(compBuf);

}
}

Expand Down

0 comments on commit d5595e9

Please sign in to comment.