Merge pull request #6857 from LK4D4/non_block_status

raft: return empty status if node is stopped
This commit is contained in:
Xiang Li 2016-11-15 16:44:50 -08:00 committed by GitHub
commit 377f19b003

View File

@ -462,8 +462,12 @@ func (n *node) ApplyConfChange(cc pb.ConfChange) *pb.ConfState {
func (n *node) Status() Status { func (n *node) Status() Status {
c := make(chan Status) c := make(chan Status)
n.status <- c select {
return <-c case n.status <- c:
return <-c
case <-n.done:
return Status{}
}
} }
func (n *node) ReportUnreachable(id uint64) { func (n *node) ReportUnreachable(id uint64) {