diff --git a/memberlist.go b/memberlist.go index 6d5f4a703..4e6854885 100644 --- a/memberlist.go +++ b/memberlist.go @@ -658,6 +658,8 @@ func (m *Memberlist) Leave(timeout time.Duration) error { m.nodeLock.Lock() state, ok := m.nodeMap[m.config.Name] + incarnation := state.Incarnation + name := state.Name m.nodeLock.Unlock() if !ok { m.logger.Printf("[WARN] memberlist: Leave but we're not in the node map.") @@ -669,9 +671,9 @@ func (m *Memberlist) Leave(timeout time.Duration) error { // intentionally. When Node equals From, other nodes know for // sure this node is gone. d := dead{ - Incarnation: state.Incarnation, - Node: state.Name, - From: state.Name, + Incarnation: incarnation, + Node: name, + From: name, } m.deadNode(&d)