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 2023/01/10 16:48:29 UTC

[GitHub] [rocketmq] RagingSpud commented on a diff in pull request #5856: [ISSUE #5740] Fix util.getIP sometimes choose localhost over LAN ip.

RagingSpud commented on code in PR #5856:
URL: https://github.com/apache/rocketmq/pull/5856#discussion_r1066024203


##########
common/src/main/java/org/apache/rocketmq/common/UtilAll.java:
##########
@@ -604,7 +606,7 @@ public static byte[] getIP() {
                             if (ipCheck(ipByte)) {
                                 if (!isInternalIP(ipByte)) {
                                     return ipByte;
-                                } else if (internalIP == null) {
+                                } else if (internalIP == null || internalIP[0] == (byte) 127) {

Review Comment:
   If we only have lo interface,`internalIP == null || internalIP[0] == (byte) 127)` will be true,so it will set `internalIP` to localhost and return.
   If we have lo and LAN ip,when it find the LAN ip,`internalIP == null || internalIP[0] == (byte) 127)` also will be true, so it will override the value of `internalIP`.
   Am I missing something?



-- 
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