forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 716
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
[Net] Implement poll(), fix race condition and enable p2p_timeouts.py test #2706
Merged
furszy
merged 11 commits into
PIVX-Project:master
from
furszy:2021_net_polling_backports
Jan 27, 2022
Merged
[Net] Implement poll(), fix race condition and enable p2p_timeouts.py test #2706
furszy
merged 11 commits into
PIVX-Project:master
from
furszy:2021_net_polling_backports
Jan 27, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
furszy
changed the title
[Net] Implement poll(), fix race condition and enable p2p_timeouts.py test
[WIP][Net] Implement poll(), fix race condition and enable p2p_timeouts.py test
Jan 3, 2022
furszy
changed the title
[WIP][Net] Implement poll(), fix race condition and enable p2p_timeouts.py test
[Net] Implement poll(), fix race condition and enable p2p_timeouts.py test
Jan 4, 2022
furszy
force-pushed
the
2021_net_polling_backports
branch
from
January 19, 2022 17:22
b9c0933
to
b51158e
Compare
rebased on master, ready to go. |
This change addresses a race condition where setnetworkactive=false wouldn't always disconnect all peers. Before this change, the following could happen: 1. Thread A -- Begins connecting to a node. 2. Thread B -- Sets kNetworkActive=false and disconnects connected nodes. 3. Thread A -- Finishes connecting and adds node to list of connected nodes. The node that was connected from Thread A remains connected and active, even though kNetworkActive=false. To fix the race, disconnections when kNetworkActive=false are now handled in the main network loop. fixes bitcoin#13038
And enable p2p_timeouts.py test. Coming from btc@2cbd1196b7a07b08cfd91417f2e8ddd09d9f2082 and btc@66f861ade9db108f979a9bdf8d90e8fca028e2a3
This separates the socket event collection logic from the logic deciding which events we're interested in at all. Adaptation of btc@7e403c0ae705455aa66f7df9a9a99f462fd4e9a8 with further code styling corrections.
This separates the select() logic from the socket handling logic, setting up for a switch to poll().
This eliminates the restriction on maximum socket descriptor number.
furszy
force-pushed
the
2021_net_polling_backports
branch
from
January 20, 2022 23:06
b51158e
to
c9fc8cc
Compare
random-zebra
approved these changes
Jan 21, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK c9fc8cc
Fuzzbawls
approved these changes
Jan 27, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK c9fc8cc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
More tier two p2p network required updates. Focused mainly on porting the sockets poll functionality to eliminate the maximum socket descriptor number restriction.
Following points tackled:
Backported Net: Fixed a race condition when disabling the network. bitcoin/bitcoin#13212 to fix a race condition on the network disable process.
Disconnect peers that have not send a VERACKs for more than 60 secs (coming from 2cbd119), and enabled the
p2p_timeouts.py
functional test which validates the functionality.Implement sockets poll functionality: