in impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/handler/Decoder.java [54:73]
private Object decode(final ChannelHandlerContext ctx, RemotingBuffer wrapper) throws Exception {
int originReaderIndex = wrapper.readerIndex();
byte magic = wrapper.readByte();
try {
if (magic != CodecHelper.PROTOCOL_MAGIC) {
throw new RemotingCodecException(String.format("MagicCode %d is wrong, expect %d", magic, CodecHelper.PROTOCOL_MAGIC));
}
return decode(wrapper, originReaderIndex);
} catch (final RemotingCodecException e) {
LOG.warn("Decode error {}, close the channel {}", e.getMessage(), ctx.channel());
ctx.channel().close().addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
LOG.warn("Close channel {} because of error {},result is {}", ctx.channel(), e, future.isSuccess());
}
});
}
return null;
}