allow searches to continue as long as the next hop is closer than the Nth closest node found so far where N is currently 16 instead of 1 (makes searches more reliable), and cache all intermediate search steps in the dht

This commit is contained in:
Arceliar 2020-03-19 21:11:17 -05:00
parent ea7e074cf0
commit b651e57203
2 changed files with 54 additions and 19 deletions

View file

@ -260,9 +260,7 @@ func (t *dht) handleRes(res *dhtRes) {
key: res.Key,
coords: res.Coords,
}
if t.isImportant(&rinfo) {
t.insert(&rinfo)
}
t.insert(&rinfo)
for _, info := range res.Infos {
if *info.getNodeID() == t.nodeID {
continue