Add information request list to DHT structure. It keeps track of requests and matches responses.

Break up SendRequest into individual functions SendRequestStore and SendRequestFindNode, which improves readability.
Alpha parameter must be now passed. MarkNodeAsSeen is exported.
Breaking up dht.iterate and embedding into 3 functions Get, FindNode, and FindValue.
This commit is contained in:
Kleissner
2021-04-09 16:07:20 +02:00
parent 7927e18572
commit c44e57a0a0
3 changed files with 202 additions and 91 deletions

View File

@@ -127,10 +127,11 @@ func (n *shortList) GetUncontacted(count int, useCount bool) (Nodes []*Node) {
// NodeMessage is a message sent by a node
type NodeMessage struct {
SenderID []byte // Sender of this message
Data []byte
Closest []*Node
Error error
SenderID []byte // Sender of the message
Data []byte // FIND_VALUE: Actual data
Closest []*Node // FIND_VALUE, FIND_NODE: Closest nodes to the requested key
Storing []*Node // FIND_VALUE: Nodes known to store the value
Error error // To be removed
}
// NodeFilterFunc is called to filter nodes based on the callers choice