Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p2p: dial using node iterator #20132

Merged
merged 17 commits into from
Oct 29, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
p2p/discover: rename lookup.next to 'advance'
  • Loading branch information
fjl committed Oct 29, 2019
commit 61523364ddc17b49c6e4b29c22e62dad1a2a554c
8 changes: 4 additions & 4 deletions p2p/discover/lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ func newLookup(ctx context.Context, tab *Table, target enode.ID, q queryFunc) *l

// run runs the lookup to completion and returns the closest nodes found.
func (it *lookup) run() []*enode.Node {
for it.next() {
for it.advance() {
}
return unwrapNodes(it.result.entries)
}

// next advances the lookup until any new nodes have been found.
// advance advances the lookup until any new nodes have been found.
// It returns false when the lookup has ended.
fjl marked this conversation as resolved.
Show resolved Hide resolved
func (it *lookup) next() bool {
func (it *lookup) advance() bool {
for it.startQueries() {
select {
case nodes := <-it.replyCh:
Expand Down Expand Up @@ -194,7 +194,7 @@ func (it *lookupIterator) Next() bool {
it.lookup = it.nextLookup(it.ctx)
continue
}
if !it.lookup.next() {
if !it.lookup.advance() {
it.lookup = nil
continue
}
Expand Down