/** 处理普通消息 */ public void packetDispatch(ByteBuf byteBuf) throws InvalidProtocolBufferException { DataBuffer dataBuffer = new DataBuffer(byteBuf); Header header = dataBuffer.getHeader(); byte[] body = dataBuffer.getBodyData(); short commandId = header.getCommandId(); short serviceId = header.getServiceId(); Packetlistener packetlistener = listenerQueue.pop(header.getSeqnum()); // logger.e("****ServerMessagePacketDispatch1111"); if (packetlistener != null) { // logger.e("****ServerMessagePacketDispatch2222"); packetlistener.onSuccess(serviceId, body); } switch (commandId) { case SysConstant.CMD_HEART: // DiscardHeart logger.e("****HEART_MESSAGE"); break; case SysConstant.CMD_FILE_NEW: case SysConstant.CMD_TASK_CHECK: case SysConstant.CMD_FILE_RESUME: case SysConstant.CMD_FILE_RESUME_REMOTE: case SysConstant.CMD_FILE_CANCEL: IMFileManager.getInstance().dispatchMessage(header, body); break; } }
/** 处理认证消息 */ public void packetDispatchAuth(ChannelHandlerContext ctx, ByteBuf msg) { DataBuffer dataBuffer = new DataBuffer(msg); Header header = dataBuffer.getHeader(); byte[] body = dataBuffer.getBodyData(); short commandId = header.getCommandId(); switch (commandId) { case SysConstant.CMD_SHAKE_HAND: logger.e("****ServerMessage-DispatchShakeHand"); ShakeHand(ctx, body, header.getSeqnum()); break; case SysConstant.CMD_HEART: // DiscardHeart logger.e("****HEART_MESSAGE"); break; } }