Skip to content

Commit

Permalink
Prevent node from adding self to successor list when joining
Browse files Browse the repository at this point in the history
Signed-off-by: Yilun <[email protected]>
  • Loading branch information
yilunzhang committed Sep 13, 2018
1 parent b1c1e90 commit c3fe04f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/chord/chord.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,13 @@ func Join(conf *Config, trans Transport, existing string) (*Ring, error) {
}

// Assign the successors
skip := 0
for idx, s := range succs {
vn.successors[idx] = s
if s != nil && s.String() != vn.String() {
vn.successors[idx-skip] = s
} else {
skip++
}
}
}

Expand Down

0 comments on commit c3fe04f

Please sign in to comment.