Skip to content

Commit 98d389a

Browse files
reverting modification in init_bind_addr
1 parent d329a00 commit 98d389a

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

src/cluster.jl

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,13 +1397,11 @@ end
13971397
bind_port = 0
13981398
end
13991399
else
1400-
@info "A2: $(getipaddrs(IPv4; loopback = false))"
14011400
bind_port = 0
14021401
try
14031402
ips = getipaddrs(IPv4; loopback = false)
14041403
n = length(ips)
14051404
bind_addr = string(ips[n])
1406-
#@info "ADDR: $(getipaddrs())"
14071405
catch
14081406
# All networking is unavailable, initialize bind_addr to the loopback address
14091407
# Will cause an exception to be raised only when used.
@@ -1416,7 +1414,7 @@ end
14161414
end
14171415
=#
14181416

1419-
function init_bind_addr()
1417+
#=function init_bind_addr()
14201418
opts = JLOptions()
14211419
14221420
@info "A2: $(getipaddrs(IPv4; loopback = false))"
@@ -1426,7 +1424,7 @@ function init_bind_addr()
14261424
ips = getipaddrs(IPv4; loopback = false)
14271425
n = length(ips)
14281426
bind_addr = string(ips[n])
1429-
#@info "ADDR: $(getipaddrs())"
1427+
@info "ADDR: $ips --- $ips"
14301428
catch
14311429
# All networking is unavailable, initialize bind_addr to the loopback address
14321430
# Will cause an exception to be raised only when used.
@@ -1447,11 +1445,38 @@ function init_bind_addr()
14471445
end
14481446
14491447
global LPROC
1448+
@info "bind_addr=$bind_addr / bind_addr_2=$bind_addr_2"
14501449
LPROC.bind_addr = bind_addr
1451-
LPROC.bind_addr_2 = bind_addr_2
1450+
LPROC.bind_addr_2 = bind_addr_2
14521451
LPROC.bind_port = UInt16(bind_port)
14531452
end
1453+
=#
14541454

1455+
function init_bind_addr()
1456+
opts = JLOptions()
1457+
if opts.bindto != C_NULL
1458+
bind_to = split(unsafe_string(opts.bindto), ":")
1459+
bind_addr = string(parse(IPAddr, bind_to[1]))
1460+
if length(bind_to) > 1
1461+
bind_port = parse(Int,bind_to[2])
1462+
else
1463+
bind_port = 0
1464+
end
1465+
else
1466+
bind_port = 0
1467+
try
1468+
bind_addr = string(getipaddr())
1469+
catch
1470+
# All networking is unavailable, initialize bind_addr to the loopback address
1471+
# Will cause an exception to be raised only when used.
1472+
bind_addr = "127.0.0.1"
1473+
end
1474+
end
1475+
global LPROC
1476+
LPROC.bind_addr = bind_addr
1477+
LPROC.bind_addr_2 = bind_addr
1478+
LPROC.bind_port = UInt16(bind_port)
1479+
end
14551480

14561481
using Random: randstring
14571482

0 commit comments

Comments
 (0)