consul: Leave does a RemovePeer RPC call

This commit is contained in:
Armon Dadgar 2013-12-09 15:01:42 -08:00
parent a8a9d2cd45
commit 08152dc66b

View file

@ -293,13 +293,12 @@ func (s *Server) Leave() error {
} }
// Request that we are removed // Request that we are removed
// TODO: Properly forward to leader
future := s.raft.RemovePeer(s.rpcListener.Addr())
// Wait for the future
ch := make(chan error, 1) ch := make(chan error, 1)
go func() { go func() {
ch <- future.Error() var out struct{}
peer := s.rpcListener.Addr().String()
err := s.connPool.RPC(leader, "Raft.RemovePeer", peer, &out)
ch <- err
}() }()
// Wait for the commit // Wait for the commit