Commit b2a3efb7 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

kbucket: fix data race

parent c0f7104f
......@@ -42,8 +42,8 @@ func (b *Bucket) find(id peer.ID) *list.Element {
}
func (b *Bucket) remove(id peer.ID) {
b.lk.RLock()
defer b.lk.RUnlock()
b.lk.Lock()
defer b.lk.Unlock()
for e := b.list.Front(); e != nil; e = e.Next() {
if e.Value.(peer.ID) == id {
b.list.Remove(e)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment