Skip to content
Merged
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
12 changes: 9 additions & 3 deletions agent/consul/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1679,12 +1679,18 @@ func (s *Server) IsLeader() bool {

// IsServer checks if this addr is of a server
func (s *Server) IsServer(addr string) bool {
for _, s := range s.raft.GetConfiguration().Configuration().Servers {
a, err := net.ResolveTCPAddr("tcp", string(s.Address))

for _, ss := range s.raft.GetConfiguration().Configuration().Servers {
a, err := net.ResolveTCPAddr("tcp", string(ss.Address))
if err != nil {
continue
}
localIP, err := net.ResolveTCPAddr("tcp", string(s.config.RaftConfig.LocalID))
if err != nil {
continue
}
if string(metadata.GetIP(a)) == addr {
// only return true if it's another server and not our local address
if string(metadata.GetIP(a)) == addr && string(metadata.GetIP(localIP)) != addr {
return true
}
}
Expand Down