From 5757e50243c0220cebaaa5449db2a435593fd006 Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Fri, 10 Jun 2016 01:03:05 -0400 Subject: [PATCH] Only return the Client's server addresses, never mix-in server peers --- command/agent/agent_endpoint.go | 35 +-------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/command/agent/agent_endpoint.go b/command/agent/agent_endpoint.go index 99b618e73..6dc0872a5 100644 --- a/command/agent/agent_endpoint.go +++ b/command/agent/agent_endpoint.go @@ -139,40 +139,7 @@ func (s *HTTPServer) listServers(resp http.ResponseWriter, req *http.Request) (i return nil, CodedError(501, ErrInvalidMethod) } - // Preallocate for at least 5x servers - const initialServerListSize = 8 - peers := make([]string, 0, initialServerListSize) - uniquePeers := make(map[string]bool, initialServerListSize) - // When the agent has an active server, get the current list of - // servers according to Raft. - if s.agent.server != nil { - raftPeers, err := s.agent.server.RaftPeers() - if err != nil { - return nil, err - } - for _, peer := range raftPeers { - _, found := uniquePeers[peer] - if !found { - uniquePeers[peer] = true - peers = append(peers, peer) - } - } - } - - // When the agent has an active client, return the union of the list - // of servers according to RpcProxy, which is possibly populated by - // Consul. - if s.agent.client != nil { - clientPeers := s.agent.client.RpcProxy().ServerRPCAddrs() - for _, peer := range clientPeers { - _, found := uniquePeers[peer] - if !found { - uniquePeers[peer] = true - peers = append(peers, peer) - } - } - } - + peers := s.agent.client.RpcProxy().ServerRPCAddrs() return peers, nil }