mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-27 12:05:23 +00:00
update search description in comments
This commit is contained in:
parent
b651e57203
commit
a09a83530f
@ -4,15 +4,13 @@ package yggdrasil
|
|||||||
|
|
||||||
// The basic idea is as follows:
|
// The basic idea is as follows:
|
||||||
// We may know a NodeID (with a mask) and want to connect
|
// We may know a NodeID (with a mask) and want to connect
|
||||||
// We begin a search by initializing a list of all nodes in our DHT, sorted by closest to the destination
|
// We beign a search by sending a dht lookup to ourself
|
||||||
// We then iteratively ping nodes from the search, marking each pinged node as visited
|
// Each time a node responds, we sort the results and filter to only include useful nodes
|
||||||
// We add any unvisited nodes from ping responses to the search, truncating to some maximum search size
|
// We then periodically send a packet to the first node from the list (after re-filtering)
|
||||||
// This stops when we either run out of nodes to ping (we hit a dead end where we can't make progress without going back), or we reach the destination
|
// This happens in parallel for each node that replies
|
||||||
// A new search packet is sent immediately after receiving a response
|
// Meanwhile, we keep a list of the (up to) 16 closest nodes to the destination that we've visited
|
||||||
// A new search packet is sent periodically, once per second, in case a packet was dropped (this slowly causes the search to become parallel if the search doesn't timeout but also doesn't finish within 1 second for whatever reason)
|
// We only consider an unvisited node useful if either the list isn't full or the unvisited node is closer to the destination than the furthest node on the list
|
||||||
|
// That gives the search some chance to recover if it hits a dead end where a node doesn't know everyone it should
|
||||||
// TODO?
|
|
||||||
// Some kind of max search steps, in case the node is offline, so we don't crawl through too much of the network looking for a destination that isn't there?
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
Loading…
Reference in New Issue
Block a user