refactor(peer): cleanup of some if boolean logic

I always get confused reading this code. Lets make it more clear, if
flush then flush; else don't flush.
pull/820/head
Brandon Philips 2014-02-07 10:22:04 -08:00
parent b60b8b94ba
commit 36556bf8e0
1 changed files with 4 additions and 4 deletions

View File

@ -123,15 +123,15 @@ func (p *Peer) heartbeat(c chan bool) {
for {
select {
case flush := <-stopChan:
if !flush {
debugln("peer.heartbeat.stop: ", p.Name)
return
} else {
if flush {
// before we can safely remove a node
// we must flush the remove command to the node first
p.flush()
debugln("peer.heartbeat.stop.with.flush: ", p.Name)
return
} else {
debugln("peer.heartbeat.stop: ", p.Name)
return
}
case <-ticker: