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

forAllOutboundPeers & forAllPeers #89

Open
harshjv opened this issue Aug 23, 2018 · 2 comments
Open

forAllOutboundPeers & forAllPeers #89

harshjv opened this issue Aug 23, 2018 · 2 comments

Comments

@harshjv
Copy link

harshjv commented Aug 23, 2018

Was taking a look at the source code and found this:

neutrino/neutrino.go

Lines 106 to 121 in e89b367

// forAllOutboundPeers is a helper function that runs closure on all outbound
// peers known to peerState.
func (ps *peerState) forAllOutboundPeers(closure func(sp *ServerPeer)) {
for _, e := range ps.outboundPeers {
closure(e)
}
for _, e := range ps.persistentPeers {
closure(e)
}
}
// forAllPeers is a helper function that runs closure on all peers known to
// peerState.
func (ps *peerState) forAllPeers(closure func(sp *ServerPeer)) {
ps.forAllOutboundPeers(closure)
}

Shouldn't forAllOutboundPeers only apply closure to ps.outboundPeers?

@cfromknecht
Copy link
Contributor

All of neutrino’s peers are outbound at the moment. Persistent just means that we will retry a connection to that peer if we get disconnected.

@cfromknecht
Copy link
Contributor

Naming could probably distinguish better, but I believe the behavior is correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants