pull/820/head
Xiang Li 2013-08-13 14:32:35 -07:00
commit 8ed555bb32
2 changed files with 4 additions and 5 deletions

View File

@ -92,7 +92,7 @@ func (p *Peer) startHeartbeat() {
func (p *Peer) stopHeartbeat(flush bool) {
// here is a problem
// the previous stop is no buffer leader may get blocked
// when heartbeat returns at line 132
// when heartbeat returns
// I make the channel with 1 buffer
// and try to panic here
select {
@ -139,18 +139,18 @@ func (p *Peer) heartbeat(c chan bool) {
} else {
// before we can safely remove a node
// we must flush the remove command to the node first
p.flushPeer()
p.flush()
debugln("peer.heartbeat.stop: ", p.Name())
return
}
case <-time.After(p.heartbeatTimeout):
p.flushPeer()
p.flush()
}
}
}
func (p *Peer) flushPeer() {
func (p *Peer) flush() {
debugln("peer.heartbeat.run: ", p.Name())
prevLogIndex := p.getPrevLogIndex()
entries, prevLogTerm := p.server.log.getEntriesAfter(prevLogIndex, p.server.maxLogEntriesPerRequest)

View File

@ -963,7 +963,6 @@ func (s *Server) RemovePeer(name string) error {
s.writeConf()
return nil
}
// Return error if peer doesn't exist.
peer := s.peers[name]
if peer == nil {