kademlia: check prox in AddNodeRecord not to try insert Self in non-existing row

This commit is contained in:
zelig 2015-05-16 16:00:27 +02:00
parent 30348839c1
commit b652c9594f

View file

@ -304,10 +304,12 @@ func (self *Kademlia) AddNodeRecords(nrs []*NodeRecord) {
if !found {
self.nodeIndex[node.Address] = node
index := proximity(self.addr, node.Address)
if index < len(self.nodeDB) {
self.nodeDB[index] = append(self.nodeDB[index], node)
}
}
}
}
/*
GetNodeRecord gives back a node record with the highest priority for desired