File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
core/src/main/scala/org/apache/spark/util Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -495,8 +495,10 @@ private[spark] object Utils extends Logging {
495495 // a better address using the local network interfaces
496496 // getNetworkInterfaces returns ifs in reverse order compared to ifconfig output order
497497 // on unix-like system. On windows, it returns in index order.
498- // It's more proper to pick ip address following the ifconfig output order
499- for (ni <- NetworkInterface .getNetworkInterfaces.toList.reverse) {
498+ // It's more proper to pick ip address following system output order.
499+ val activeNetworkIFs = NetworkInterface .getNetworkInterfaces.toList
500+ val reOrderedNetworkIFs = if (isWindows) activeNetworkIFs else activeNetworkIFs.reverse
501+ for (ni <- reOrderedNetworkIFs) {
500502 for (addr <- ni.getInetAddresses if ! addr.isLinkLocalAddress &&
501503 ! addr.isLoopbackAddress && addr.isInstanceOf [Inet4Address ]) {
502504 // We've found an address that looks reasonable!
You can’t perform that action at this time.
0 commit comments