dianjifzm commented on code in PR #13745:
URL: https://github.com/apache/dubbo/pull/13745#discussion_r1493972609


##########
dubbo-common/src/main/java/org/apache/dubbo/common/utils/NetUtils.java:
##########
@@ -387,19 +386,18 @@ private static InetAddress getLocalAddress0() {
             logger.warn(e);
         }
 
+        InetAddress localAddress = getLocalAddressV6();
+        if (localAddress != null) {
+            return localAddress;
+        }

Review Comment:
   最老的代码,语义的表达不明确,还是建议整理清楚。
   
   391行:localAddress = InetAddress.getLocalHost(); 给默认值赋了值,即使if 
(addressOp.isPresent()) ==false,也回返回localhost
   
   后来加了IPv6的支持,改变了原来的语义
   400行:localAddress = getLocalAddressV6(); 重新给默认值赋值,导致默认值不再是localhost



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to