mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
获取主机网络连接信息时按索引从小到大排序,优先使用索引值小的网络接口。
This commit is contained in:
parent
00228f3b3e
commit
1adc25308f
@ -155,6 +155,9 @@ public class NetUtils {
|
||||
log.warn("[Net] findNetworkInterface failed", e);
|
||||
}
|
||||
|
||||
// sort by interface index, the smaller is preferred.
|
||||
validNetworkInterfaces.sort(Comparator.comparingInt(NetworkInterface::getIndex));
|
||||
|
||||
// Try to find the preferred one
|
||||
for (NetworkInterface networkInterface : validNetworkInterfaces) {
|
||||
if (isPreferredNetworkInterface(networkInterface)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user