-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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: Move ping data to net_processing #20721
Conversation
8417bb2
to
7f736c7
Compare
Rebased on master. This is now ready for review. |
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.
Seems okay. Though, "jnewbery deleted a comment from sipa 3 days ago" ?
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
ha. There were two comments from sheffine saying "why are you emailing me?" and one from sipa saying "sheffine, you're confused", so I deleted them all to reduce noise. |
Censorship!!! (yes, that's indeed what happened) |
Thanks for the review @ajtowns. I'll move the commits around a bit to address your comments. |
7f736c7
to
6f0309b
Compare
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.
Can't really comment on the overall goal, as I don't really have a lot of context regarding either locks, mutexes, or peer management, but the linked motivation sounded good to me. The PR is easy to follow and each step makes sense to me. I found the first commit message to be a bit confusing:
No need to create another shared_ptr if ProcessMessages() already
has one in hand.
I take it to mean something along the lines of "Instead of creating another shared ptr, let's pass one that the callsite already has on hand.".
code review ACK 6f0309b
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.
Concept ACK, although I have a bit of confusion about what constitutes net vs application layer, namely why best ping is still in CNode
. You broke a few functional tests by removing minping from copyStats()
which I assume is accidental?
For renaming, I personally think "best" is more informative than "min" but there's some inconsistency in naming now. It's still called 'minping' in getpeerinfo
and m_min_ping_usec
in CNodeStats
.
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.
Concept ACK
A couple of thoughts on preliminary quick skim-through.
6f0309b
to
d666804
Compare
Thanks for the reviews, @glozow and @jonatack. I've addressed your comments: https://github.com/bitcoin/bitcoin/compare/6f0309b4743d05c512fc86d2d206f72d512c5c93..d666804b7b2d5006c37b86f5f88e344216ad0862. |
rebased |
d666804
to
9ee8d46
Compare
Rebased |
a3ec04b
to
a5e15ae
Compare
reACK a5e15ae rebase-only by |
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 a5e15ae
lost track of the different versions so just re-reviewed the whole diff commit by commit.
definitely like having the m_peer_connect_timeout
check as a function in net
more than duplicating system time check in net_processing
in the future, I think it could make sense to have -peertimeout
be limited to regtest. it's hidden behind debug-help, but technically possible on mainnet. I don't see how it'd be useful on mainnet though.
In the scripted diff I don't like that it may modify non-git user files (e.g. a review ACK a5e15ae 🥉 Show signature and timestampSignature:
Timestamp of file with hash |
- rename to ShouldRunInactivityChecks (bitcoin#20721 (comment)) - take optional time now (bitcoin#20721 (comment)) - call from within InactivityChecks (bitcoin#20721 (comment)) - update comment (bitcoin#20721 (comment)) - change ordering of inequality (bitcoin#20721 (comment)) - make inline (bitcoin#20721 (comment))
- rename to ShouldRunInactivityChecks (bitcoin#20721 (comment)) - take optional time now (bitcoin#20721 (comment)) - call from within InactivityChecks (bitcoin#20721 (comment)) - update comment (bitcoin#20721 (comment)) - change ordering of inequality (bitcoin#20721 (comment))
- rename to ShouldRunInactivityChecks (bitcoin#20721 (comment)) - take optional time now (bitcoin#20721 (comment)) - call from within InactivityChecks (bitcoin#20721 (comment)) - update comment (bitcoin#20721 (comment)) - change ordering of inequality (bitcoin#20721 (comment))
- rename to ShouldRunInactivityChecks (bitcoin#20721 (comment)) - take optional time now (bitcoin#20721 (comment)) - call from within InactivityChecks (bitcoin#20721 (comment)) - update comment (bitcoin#20721 (comment)) - change ordering of inequality (bitcoin#20721 (comment))
- rename to ShouldRunInactivityChecks (bitcoin#20721 (comment)) - take optional time now (bitcoin#20721 (comment)) - call from within InactivityChecks (bitcoin#20721 (comment)) - update comment (bitcoin#20721 (comment)) - change ordering of inequality (bitcoin#20721 (comment))
- rename to ShouldRunInactivityChecks (bitcoin#20721 (comment)) - take optional time now (bitcoin#20721 (comment)) - call from within InactivityChecks (bitcoin#20721 (comment)) - update comment (bitcoin#20721 (comment)) - change ordering of inequality (bitcoin#20721 (comment))
- rename to ShouldRunInactivityChecks (bitcoin#20721 (comment)) - take optional time now (bitcoin#20721 (comment)) - call from within InactivityChecks (bitcoin#20721 (comment)) - update comment (bitcoin#20721 (comment)) - change ordering of inequality (bitcoin#20721 (comment))
- rename to ShouldRunInactivityChecks (bitcoin#20721 (comment)) - take optional time now (bitcoin#20721 (comment)) - call from within InactivityChecks (bitcoin#20721 (comment)) - update comment (bitcoin#20721 (comment)) - change ordering of inequality (bitcoin#20721 (comment))
5ed535a [net] Changes to RunInactivityChecks (John Newbery) Pull request description: Updates the RunInactivityChecks() function: - rename to ShouldRunInactivityChecks (#20721 (comment)) - take optional time now (#20721 (comment)) - call from within InactivityChecks (#20721 (comment)) - update comment (#20721 (comment)) - change ordering of inequality (#20721 (comment)) - ~make inline (#20721 (comment) ACKs for top commit: laanwj: Code review ACK 5ed535a Tree-SHA512: e6ac8e8cce5cddc84a52a40c908634c25f58be74512d642840d7bd7fa65c3d90a0f46cc19e4865b3fae7c933138247f58356167a60a5c519305cfd6d05e51f51
…20721 5ed535a [net] Changes to RunInactivityChecks (John Newbery) Pull request description: Updates the RunInactivityChecks() function: - rename to ShouldRunInactivityChecks (bitcoin#20721 (comment)) - take optional time now (bitcoin#20721 (comment)) - call from within InactivityChecks (bitcoin#20721 (comment)) - update comment (bitcoin#20721 (comment)) - change ordering of inequality (bitcoin#20721 (comment)) - ~make inline (bitcoin#20721 (comment) ACKs for top commit: laanwj: Code review ACK 5ed535a Tree-SHA512: e6ac8e8cce5cddc84a52a40c908634c25f58be74512d642840d7bd7fa65c3d90a0f46cc19e4865b3fae7c933138247f58356167a60a5c519305cfd6d05e51f51
Summary: Refactor only. No change in behaviour. Partial backport of [[bitcoin/bitcoin#20721 | core#20721]]: bitcoin/bitcoin@f8b3058 Ref T1696. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Maniphest Tasks: T1696 Differential Revision: https://reviews.bitcoinabc.org/D10873
Summary: ``` Moves the logic to prevent running inactivity checks until the peer has been connected for -peertimeout time into its own function. This will be reused by net_processing later. ``` Partial backport of [[bitcoin/bitcoin#20721 | core#20721]]: bitcoin/bitcoin@1a07600 Depends on D10873. Ref T1696. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Maniphest Tasks: T1696 Differential Revision: https://reviews.bitcoinabc.org/D10875
Summary: Partial backport of [[bitcoin/bitcoin#20721 | core#20721]]: bitcoin/bitcoin@0b43b81 Ref T1696. Depends on D10875. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Maniphest Tasks: T1696 Differential Revision: https://reviews.bitcoinabc.org/D10876
Summary: ``` Ping messages are an application-level mechanism. Move timeout logic from net to net processing. ``` Partial backport of [[bitcoin/bitcoin#20721 | core#20721]]: bitcoin/bitcoin@dd2646d Ref T1696. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Maniphest Tasks: T1696 Differential Revision: https://reviews.bitcoinabc.org/D10877
Summary: Partial backport of [[bitcoin/bitcoin#20721 | core#20721]]: bitcoin/bitcoin@45dcf22 Depends on D10898. Ref T1696. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Maniphest Tasks: T1696 Differential Revision: https://reviews.bitcoinabc.org/D10899
Summary: Original script: ``` -BEGIN VERIFY SCRIPT- sed -i 's/fPingQueued/m_ping_queued/g' src/net_processing.cpp sed -i 's/nMinPingUsecTime/m_min_ping_time/g' src/net.* src/net_processing.cpp src/test/net_tests.cpp sed -i 's/nPingNonceSent/m_ping_nonce_sent/g' src/net_processing.cpp sed -i 's/nPingUsecTime/m_last_ping_time/g' src/net.* -END VERIFY SCRIPT- ``` Completes backport of [[bitcoin/bitcoin#20721 | core#20721]]: bitcoin/bitcoin@a5e15ae Depends on D10899. Ref T1696. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Maniphest Tasks: T1696 Differential Revision: https://reviews.bitcoinabc.org/D10900
This continues the work of moving application layer data into net_processing, by moving all ping data into the new Peer object added in #19607.
For motivation, see #19398.