-
Notifications
You must be signed in to change notification settings - Fork 37.7k
refactor: Split per-peer parts of net module into new node/connection module #28686
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
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. 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. |
The idea here is to restructure This PR just moves code around; the idea is that future PRs would improve the separation more (see https://github.com/ajtowns/bitcoin/commits/202308-netnode and #28252 (comment)) and, eventually, breaking the circular dependency between |
9cfa7d8
to
468b2fb
Compare
|
I did think about that, but it's confusing in its own way: we have |
While we are bike-shedding the naming, I actually think |
468b2fb
to
1116e57
Compare
I like it! Done. |
virtual bool ShouldReconnectV1() const noexcept = 0; | ||
}; | ||
|
||
class V1Transport final : public Transport |
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.
What do you think of moving the transport impls to net.cpp (or their own module)?. They aren't really part of this interface, more of a implementation detail.
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.
The class info is exposed for unit tests, and you at least need class Transport
in order to know what a CNode
looks like. Separating out the V1/V2 implementation details alone doesn't seem like much of a win. (And wouldn't really be a win at all if we just had a concrete Transport class instead of the replaceable virtual setup, cf #28331 (comment))
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.
(The Transport
stuff is all specific to a single connection, so it would go in node/connection.cpp
rather than net.cpp
per the logic of this PR)
Move per-peer code from net into a new node/connection module. This is intended to capture logic that is lower-level than the p2p protocol (done in net_processing), but higher-level than raw bits-over-the-wire (handled by Sock).
1116e57
to
fb03ca1
Compare
Concept ACK. Good thing this separation doesn't require additional wrappers and fields. |
ACK fb03ca1 |
🐙 This pull request conflicts with the target branch and needs rebase. |
Are you still working on this? |
Closing as up-for-grabs (will grab it myself in a while if no one else does first) |
Move per-peer code from net into a new node/connection module. This is intended to capture logic that is lower-level than the p2p protocol (done in net_processing), but higher-level than raw bits-over-the-wire (handled by Sock).