Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
New connection strategy #1807
Partially resolves #1753
This PR adds new outboundvalid field to PeerRecord that is stored in database. outboundvalid means that at least once it was possible to make valid outbound connection to that peer. Peers with outboundvalid flags are first to try to join to and first to send to other peers as a response to GETPEERS message.
This PR also makes MAX_PENDING_PEERS setting only applicable to incoming connections, as OverlayManagerImpl already has logic for initiating only proper number of outgoing connections at any time, and it would be bad to have all PENDING slots taken by inbound connection from misbehaving peers.
MonsieurNicolas left a comment
Looks good overall! Not too complicated.
I think it plays nice with existing peers too.
There are a couple things missing, use of random (to make the network better connected), and changes to
Updates to getPeers