You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/11/03 09:58:22 UTC

[GitHub] [rocketmq] lizhanhui commented on a diff in pull request #5463: [ISSUE #5462] Remove RemotingCommand.decode parse header repeated calculation

lizhanhui commented on code in PR #5463:
URL: https://github.com/apache/rocketmq/pull/5463#discussion_r1012695357


##########
remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java:
##########
@@ -181,13 +181,12 @@ public static RemotingCommand decode(final ByteBuffer byteBuffer) throws Remotin
 
     public static RemotingCommand decode(final ByteBuf byteBuffer) throws RemotingCommandException {
         int length = byteBuffer.readableBytes();
-        int oriHeaderLen = byteBuffer.readInt();
-        int headerLength = getHeaderLength(oriHeaderLen);
+        int headerLength = byteBuffer.readInt();

Review Comment:
   According to the frame layout, the first byte of the header length is used as a bit-field, flagging how the header is serialized.  Only the following 3 bytes are actually employed to represent header length. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org