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

peer: Simplify PushAddrMsg method loop. #232

Merged
merged 18 commits into from May 27, 2016
Merged

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented May 27, 2016

Upstream commit e03fa30.

Dirbaio and others added 18 commits December 21, 2015 20:59
The getaddr msg is usually replied to with an addr msg, but if
the other peer does not have any addresses to share it will not
reply at all (instead of replying with an addr msg with 0 addresses).
Therefore, the getaddr msg is not guaranteed a reply, so this commit
removes it from stall detection to avoid incorrectly kicking
such peers.
When a persistent peer is disconnected (for example due to a
network timeout), a connection retry is issued. The logic for
doing so failed to remove the peer from the peerState, causing
dead peer connections to fill the peerState. Since connections
in the peerState are counted towards the maxPeers limit, this
would cause btcd to eventually stop retrying connection.

This commit fixes the issue by properly removing the peer from
the peerState.
Reviewed changelog and fixed 2 tiny typos.
 guidelinestherin ---> guidelines therein.
Changed the order of return values described in the docs to be
consistent with the function’s actual return value signature.
Found via github.com/mvdan/interfacer.
Also disconnect the failed peer to allow the peerDoneHandler goroutine
to exit, instead of hanging around. Fixes btcsuite#583.
This implementation ensures that all addresses have an equal chance of
being included in the addr message. It also moves the pseudorandom number
generator seeding to package level so that it can be overridden for
testing if required.
Contains the following upstream commits:
- 87182a2
  - This commit does not apply to Decred so it has been reverted
- 89af747
  - This commit has already been cherry picked and is a NOOP
- d0cdd53
  - This commit has already been cherry picked and is a NOOP
- df20c10
- ff0c787
- 6e133b5
- 34a94b7
- 14ccab8
Contains the following upstream commits:
- 829e87a
  - This commit does not apply to Decred so it has been reverted
- d0cdd53
  - This commit does not apply to Decred so it has been reverted
- 7996eb1
  - This commit has already been cherry picked and is a NOOP
- 1944637
- f5ded65
- 407fcc2
@alexlyp
Copy link
Member

alexlyp commented May 27, 2016

tACK runs well on testnet and simnet

@jcvernaleo jcvernaleo added this to the v0.1.5 milestone May 27, 2016
@cjepson
Copy link
Contributor

cjepson commented May 27, 2016

OK

@alexlyp alexlyp merged commit c9c32d5 into decred:master May 27, 2016
@davecgh davecgh deleted the peer-loop branch May 27, 2016 14:35
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.

None yet

10 participants