mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +00:00
p2p/discover: clarify lookup behavior on empty table
We have changed this behavior, better clarify in comment. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
a9f9e0d589
commit
72d3e881b3
1 changed files with 4 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ import (
|
||||||
// lookup performs a network search for nodes close to the given target. It approaches the
|
// lookup performs a network search for nodes close to the given target. It approaches the
|
||||||
// target by querying nodes that are closer to it on each iteration. The given target does
|
// target by querying nodes that are closer to it on each iteration. The given target does
|
||||||
// not need to be an actual node identifier.
|
// not need to be an actual node identifier.
|
||||||
|
// lookup on an empty table will return immediately with no nodes.
|
||||||
type lookup struct {
|
type lookup struct {
|
||||||
tab *Table
|
tab *Table
|
||||||
queryfunc queryFunc
|
queryfunc queryFunc
|
||||||
|
|
@ -142,6 +143,9 @@ func (it *lookup) query(n *enode.Node, reply chan<- []*enode.Node) {
|
||||||
|
|
||||||
// lookupIterator performs lookup operations and iterates over all seen nodes.
|
// lookupIterator performs lookup operations and iterates over all seen nodes.
|
||||||
// When a lookup finishes, a new one is created through nextLookup.
|
// When a lookup finishes, a new one is created through nextLookup.
|
||||||
|
// LookupIterator waits for table initialization and triggers a table refresh
|
||||||
|
// when necessary.
|
||||||
|
|
||||||
type lookupIterator struct {
|
type lookupIterator struct {
|
||||||
buffer []*enode.Node
|
buffer []*enode.Node
|
||||||
nextLookup lookupFunc
|
nextLookup lookupFunc
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue