Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Fix advertise address bug in cluster config #1097

Merged
merged 1 commit into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions cluster/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,8 @@ func ConfigProcess() {
if swimAdvertiseAddrStr != "" {
swimAdvertiseAddr, err = net.ResolveTCPAddr("tcp", swimAdvertiseAddrStr)
if err != nil {
log.Fatal(4, "CLU Config: swim-advertise-addr is not a valid TCP address: %s", err.Error())
log.Fatalf("CLU Config: swim-advertise-addr is not a valid TCP address: %s", err.Error())
}
} else {
swimAdvertiseAddr = swimBindAddr
}
}
}
8 changes: 6 additions & 2 deletions cluster/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ func NewMemberlistManager(thisNode HTTPNode) *MemberlistManager {
mgr.cfg = memberlist.DefaultLANConfig() // use this as base so that the other settings have proper defaults
mgr.cfg.BindPort = swimBindAddr.Port
mgr.cfg.BindAddr = swimBindAddr.IP.String()
mgr.cfg.AdvertisePort = swimAdvertiseAddr.Port
mgr.cfg.AdvertiseAddr = swimAdvertiseAddr.IP.String()
if swimAdvertiseAddr == nil {
mgr.cfg.AdvertisePort = swimBindAddr.Port
} else {
mgr.cfg.AdvertisePort = swimAdvertiseAddr.Port
mgr.cfg.AdvertiseAddr = swimAdvertiseAddr.IP.String()
}
mgr.cfg.TCPTimeout = swimTCPTimeout
mgr.cfg.IndirectChecks = swimIndirectChecks
mgr.cfg.RetransmitMult = swimRetransmitMult
Expand Down