Skip to content

Commit 02840e8

Browse files
committed
check the network,Local site be the preferred one
1 parent 403e127 commit 02840e8

File tree

1 file changed

+6
-1
lines changed
  • dubbo-common/src/main/java/org/apache/dubbo/common/utils

1 file changed

+6
-1
lines changed

dubbo-common/src/main/java/org/apache/dubbo/common/utils/NetUtils.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ public static NetworkInterface findNetworkInterface() {
544544
}
545545
}
546546

547+
547548
if (result == null) { // If not found, try to get the first one
548549
for (NetworkInterface networkInterface : validNetworkInterfaces) {
549550
Enumeration<InetAddress> addresses = networkInterface.getInetAddresses();
@@ -552,7 +553,11 @@ public static NetworkInterface findNetworkInterface() {
552553
if (addressOp.isPresent()) {
553554
try {
554555
if (addressOp.get().isReachable(100)) {
555-
return networkInterface;
556+
if (addressOp.get().isSiteLocalAddress()) {
557+
return networkInterface;
558+
} else {
559+
result = networkInterface;
560+
}
556561
}
557562
} catch (IOException e) {
558563
// ignore

0 commit comments

Comments
 (0)