consul: Leave does a RemovePeer RPC call

This commit is contained in:
Armon Dadgar 2013-12-09 15:01:42 -08:00
parent e699a14fe3
commit 500927cbb1
1 changed files with 4 additions and 5 deletions

View File

@ -293,13 +293,12 @@ func (s *Server) Leave() error {
}
// 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)
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