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

addrmgr: skip never-successful addresses #1313

Merged
merged 2 commits into from
Jun 27, 2018
Merged

addrmgr: skip never-successful addresses #1313

merged 2 commits into from
Jun 27, 2018

Conversation

dajohi
Copy link
Member

@dajohi dajohi commented Jun 22, 2018

A node that has never been successfully connected should not be
announced.

@davecgh davecgh added this to the 1.3.0 milestone Jun 22, 2018
Copy link
Member

@davecgh davecgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update the comment on isBad which refers to It has failed ten times ... since it's five with this PR.

@@ -95,7 +95,7 @@ func (ka *KnownAddress) isBad() bool {
}

// Never succeeded?
if ka.lastsuccess.IsZero() && ka.attempts >= numRetries {
if ka.lastsuccess.IsZero() || ka.attempts >= numRetries {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need to review all the surrounding code to be sure, but this doesn't look right to me at first glance. An address should not be marked bad before it's had a few tries (numRetries in this case) to succeed.

With this change, it seems like an address will be marked bad when lastsuccess is zero, which should always happen before the first connection has been made.

A node that has never been successfully connected should not be
announced.  Also, change maxFailures from 10 to a more conservative 5.
@dajohi dajohi changed the title addrmgr: fix isBad addrmgr: skip never-successful addresses Jun 26, 2018
@dajohi
Copy link
Member Author

dajohi commented Jun 26, 2018

The AddressCache API is used by dcrd in server.go to reply to GetAddr requests.

        // Get the current known addresses from the address manager.
        addrCache := sp.server.addrManager.AddressCache()

        // Push the addresses.
        sp.pushAddrMsg(addrCache)

Now dcrd will not share nodes that itself has never connected to.

When a peer sends an addr message, use the same time for each
address sent.  This saves up to wire.MaxAddrPerMsg-1 syscalls.
@davecgh davecgh merged commit 2f5e473 into decred:master Jun 27, 2018
@dajohi dajohi deleted the addrmgr1 branch February 28, 2019 00:56
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

Successfully merging this pull request may close these issues.

2 participants