p2p/discover: fix off by one error causing buckets to contain duplicates

This commit is contained in:
Felix Lange
2015-03-30 17:23:28 +02:00
parent de7af720d6
commit a77c431e37
2 changed files with 43 additions and 1 deletions

View File

@ -328,7 +328,7 @@ func (b *bucket) bump(n *Node) bool {
if b.entries[i].ID == n.ID {
n.bumpActive()
// move it to the front
copy(b.entries[1:], b.entries[:i+1])
copy(b.entries[1:], b.entries[:i])
b.entries[0] = n
return true
}