mirror of
https://github.com/status-im/consul.git
synced 2025-01-11 14:24:39 +00:00
Tweaks error handling case to not panic further down.
This commit is contained in:
parent
d38ceaa3ea
commit
1ec16b9243
@ -70,16 +70,15 @@ func FloodJoins(logger *log.Logger, portFn FloodPortFn,
|
|||||||
if port, ok := portFn(server); ok {
|
if port, ok := portFn(server); ok {
|
||||||
addr = net.JoinHostPort(addr, fmt.Sprintf("%d", port))
|
addr = net.JoinHostPort(addr, fmt.Sprintf("%d", port))
|
||||||
} else {
|
} else {
|
||||||
// globalSerf.Join expects bracketed ipv6 addresses
|
// If we have an IPv6 address, we should add brackets,
|
||||||
ip := net.ParseIP(addr)
|
// single globalSerf.Join expects that.
|
||||||
if ip == nil {
|
if ip := net.ParseIP(addr); ip != nil {
|
||||||
// should never happen
|
if ip.To4() == nil {
|
||||||
|
addr = fmt.Sprintf("[%s]", addr)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
logger.Printf("[DEBUG] consul: Failed to parse IP %s", addr)
|
logger.Printf("[DEBUG] consul: Failed to parse IP %s", addr)
|
||||||
}
|
}
|
||||||
// If we have an IPv6 address, we should add brackets
|
|
||||||
if ip.To4() == nil {
|
|
||||||
addr = fmt.Sprintf("[%s]", addr)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the join!
|
// Do the join!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user