File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -1279,12 +1279,26 @@ function terminate_all_workers()
12791279end
12801280
12811281function choose_bind_addr ()
1282- # On HPC clusters, link-local addresses are usually not usable for
1282+ # We prefer IPv4 over IPv6.
1283+ #
1284+ # We also prefer non-link-local over link-local.
1285+ # (This is because on HPC clusters, link-local addresses are usually not usable for
12831286 # communication between compute nodes.
12841287 # Therefore, we use the first non-link-local IPv4 address.
1285- addrs = Sockets. getipaddrs (Sockets. IPv4)
1286- filter! (! Sockets. islinklocaladdr, addrs)
1287- return first (addrs)
1288+ #
1289+ # Therefore, our order of preference is:
1290+ # 1. Non-link-local IPv4
1291+ # 2. Non-link-local IPv6
1292+ # 3. Link-local IPv4
1293+ # 4. Link-local IPv6
1294+ addrs = getipaddrs ()
1295+ i = something (
1296+ findfirst (ip -> ip isa IPv4 && ! islinklocaladdr (ip), addrs), # first non-link-local IPv4
1297+ findfirst (ip -> ! islinklocaladdr (ip), addrs), # first non-link-local
1298+ findfirst (ip -> ip isa IPv4, addrs), # first IPv4
1299+ 1 , # first address
1300+ )
1301+ return addrs[i]
12881302end
12891303
12901304# initialize the local proc network address / port
You can’t perform that action at this time.
0 commit comments