@@ -1397,13 +1397,11 @@ end
1397
1397
bind_port = 0
1398
1398
end
1399
1399
else
1400
- @info "A2: $(getipaddrs(IPv4; loopback = false))"
1401
1400
bind_port = 0
1402
1401
try
1403
1402
ips = getipaddrs(IPv4; loopback = false)
1404
1403
n = length(ips)
1405
1404
bind_addr = string(ips[n])
1406
- #@info "ADDR: $(getipaddrs())"
1407
1405
catch
1408
1406
# All networking is unavailable, initialize bind_addr to the loopback address
1409
1407
# Will cause an exception to be raised only when used.
@@ -1416,7 +1414,7 @@ end
1416
1414
end
1417
1415
=#
1418
1416
1419
- function init_bind_addr ()
1417
+ #= function init_bind_addr()
1420
1418
opts = JLOptions()
1421
1419
1422
1420
@info "A2: $(getipaddrs(IPv4; loopback = false))"
@@ -1426,7 +1424,7 @@ function init_bind_addr()
1426
1424
ips = getipaddrs(IPv4; loopback = false)
1427
1425
n = length(ips)
1428
1426
bind_addr = string(ips[n])
1429
- # @info "ADDR: $(getipaddrs()) "
1427
+ @info "ADDR: $ips --- $ips "
1430
1428
catch
1431
1429
# All networking is unavailable, initialize bind_addr to the loopback address
1432
1430
# Will cause an exception to be raised only when used.
@@ -1447,11 +1445,38 @@ function init_bind_addr()
1447
1445
end
1448
1446
1449
1447
global LPROC
1448
+ @info "bind_addr=$bind_addr / bind_addr_2=$bind_addr_2"
1450
1449
LPROC.bind_addr = bind_addr
1451
- LPROC. bind_addr_2 = bind_addr_2
1450
+ LPROC.bind_addr_2 = bind_addr_2
1452
1451
LPROC.bind_port = UInt16(bind_port)
1453
1452
end
1453
+ =#
1454
1454
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
1455
1480
1456
1481
using Random: randstring
1457
1482
0 commit comments