Skip to content

Commit

Permalink
benchmark hello2 cgi
Browse files Browse the repository at this point in the history
  • Loading branch information
astrozhou committed Mar 10, 2017
1 parent 0e13202 commit 70856a8
Show file tree
Hide file tree
Showing 3 changed files with 208 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class NetMsgHeaderHandler extends ChannelInboundHandlerAdapter {
static {
CMD_PATH_MAP.put(Main.CmdID.CMD_ID_HELLO_VALUE, "mars/hello");
CMD_PATH_MAP.put(Main.CmdID.CMD_ID_SEND_MESSAGE_VALUE, "/mars/sendmessage");
CMD_PATH_MAP.put(Main.CmdID.CMD_ID_HELLO2_VALUE, "/mars/hello2");
}

private ConcurrentHashMap<ChannelHandlerContext, Long> linkTimeout = new ConcurrentHashMap<>();
Expand Down Expand Up @@ -110,6 +111,21 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
}
else {

}
break;
case Main.CmdID.CMD_ID_HELLO2_VALUE:
requestDataStream = new ByteArrayInputStream(msgXp.body);

inputStream = doHttpRequest(webCgi, requestDataStream);
if (inputStream != null) {
msgXp.body = IOUtils.toByteArray(inputStream);
IOUtils.closeQuietly(requestDataStream);
byte[] respBuf = msgXp.encode();
logger.info(LogUtils.format("client resp, cmdId=%d, seq=%d, resp.len=%d", msgXp.cmdId, msgXp.seq, msgXp.body == null ? 0 : msgXp.body.length));
ctx.writeAndFlush(ctx.alloc().buffer().writeBytes(respBuf));
}
else {

}
break;
case Main.CmdID.CMD_ID_SEND_MESSAGE_VALUE:
Expand Down
Loading

0 comments on commit 70856a8

Please sign in to comment.