let knowen peer to rejoin to the cluster

pull/820/head
Xiang Li 2013-07-10 20:02:24 -07:00
parent d0da319e26
commit b9e1da8ac2
3 changed files with 5 additions and 2 deletions

View File

@ -250,6 +250,7 @@ func (p *Peer) sendVoteRequest(req *RequestVoteRequest, c chan *RequestVoteRespo
debugln("peer.vote: ", p.server.Name(), "->", p.Name())
req.peer = p
if resp := p.server.Transporter().SendVoteRequest(p.server, p, req); resp != nil {
debugln("peer.vote: recv", p.server.Name(), "<-", p.Name())
resp.peer = p
c <- resp
}

View File

@ -516,6 +516,8 @@ func (s *Server) candidateLoop() {
} else if resp.Term > s.currentTerm {
s.debugln("server.candidate.vote.failed")
s.setCurrentTerm(resp.Term, "", false)
} else {
s.debugln("server.candidate.vote: denied")
}
case e := <-s.c:
@ -808,7 +810,7 @@ func (s *Server) AddPeer(name string) error {
// Do not allow peers to be added twice.
if s.peers[name] != nil {
return DuplicatePeerError
return nil
}
// Only add the peer if it doesn't have the same name.

View File

@ -403,7 +403,7 @@ func TestServerMultiNode(t *testing.T) {
}
mutex.RUnlock()
for i := 0; i < 20; i++ {
for i := 0; i < 200000; i++ {
retry := 0
fmt.Println("Round ", i)