Skip to content

Commit ca6ee0c

Browse files
authored
Merge pull request #1 from volgariver6/fix-issue-272
fixed a data race issue
2 parents 9c88db2 + bb7bce1 commit ca6ee0c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

memberlist.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,8 @@ func (m *Memberlist) Leave(timeout time.Duration) error {
655655

656656
m.nodeLock.Lock()
657657
state, ok := m.nodeMap[m.config.Name]
658+
incarnation := state.Incarnation
659+
name := state.Name
658660
m.nodeLock.Unlock()
659661
if !ok {
660662
m.logger.Printf("[WARN] memberlist: Leave but we're not in the node map.")
@@ -666,9 +668,9 @@ func (m *Memberlist) Leave(timeout time.Duration) error {
666668
// intentionally. When Node equals From, other nodes know for
667669
// sure this node is gone.
668670
d := dead{
669-
Incarnation: state.Incarnation,
670-
Node: state.Name,
671-
From: state.Name,
671+
Incarnation: incarnation,
672+
Node: name,
673+
From: name,
672674
}
673675
m.deadNode(&d)
674676

0 commit comments

Comments
 (0)