You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2020/02/12 04:55:49 UTC

[GitHub] [rocketmq] rushsky518 commented on a change in pull request #1758: Fix bug in MessageClientIDSetter

rushsky518 commented on a change in pull request #1758: Fix bug in MessageClientIDSetter
URL: https://github.com/apache/rocketmq/pull/1758#discussion_r378040582
 
 

 ##########
 File path: common/src/main/java/org/apache/rocketmq/common/message/MessageClientIDSetter.java
 ##########
 @@ -37,13 +37,10 @@
         } catch (Exception e) {
             ip = createFakeIP();
         }
-        LEN = ip.length + 2 + 4 + 4 + 2;
-        ByteBuffer tempBuffer = ByteBuffer.allocate(ip.length + 2 + 4);
-        tempBuffer.position(0);
+        LEN = ip.length + 4 + 4 + 4 + 2;
+        ByteBuffer tempBuffer = ByteBuffer.allocate(ip.length + 4 + 4);
         tempBuffer.put(ip);
-        tempBuffer.position(ip.length);
         tempBuffer.putInt(UtilAll.getPid());
-        tempBuffer.position(ip.length + 2);
 
 Review comment:
   "The pid_t data type is a signed integer"
   https://www.gnu.org/software/libc/manual/html_node/Process-Identification.html

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services