-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[moveonly] Fix CConnman template methods to be fully-defined in net.h #13239
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
|
It could be helpful to review using |
b33d4a2 to
d53c3a6
Compare
|
utACK d53c3a6. |
d53c3a6 to
ff9e94a
Compare
|
Rebased |
|
utACK ff9e94a65f990905abc48aafae2d5ff0cb61778b
|
|
@sipa Agreed! Was just added: https://blog.github.com/2018-04-05-git-217-released/ Learned about it from @ajtowns here: #13021 (comment) |
|
NodeFullyConnected is not a templated method, so I don't see why it needs to be fully-defined. (Using it in a templated method should be fine, no? Also note that this previously compiled without issues.) |
|
@MarcoFalke here's the build failure from #13235. Is there another approach you recommend? https://travis-ci.org/bitcoin/bitcoin/jobs/379011082 Note |
|
I spent a bit of time going down the path of adding the net.cpp sources to libbitcoin_wallet.a, but this ended up seeming like the more narrow fix, because the other approach kept wanting to pull more of the project into the wallet lib. I could see an argument for factoring the CConnman dependency out of CWallet. |
|
Concept ACK |
src/net.h
Outdated
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.
Conman is not "information about a peer"
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.
Fixed
This enables CConnman template methods to have access to a full declaration of CNode, such that their implementation can be fully contained in net.h.
The CConnman template methods ForEachNode and ForEachNodeThen use NodeFullyConnected, so when defined in net.cpp, outside callers were lacking the implementation necessary for the template methods. See https://travis-ci.org/bitcoin/bitcoin/jobs/379011082 for an example of how this failure looked in practice. This existed on CConnman before because CConnman could not rely on CNode methods for its template methods. Now that the CNode declaration is first, this is the more natural place to represent this code.
ff9e94a to
1189489
Compare
|
Fixed comment location in e2db96e, and squashed the latter two commits. |
|
Unnecessary thanks to build fix now in #13235 |
Currently template methods
CConnman::ForEachNodeandCConnman::ForEachNodeThenrely onCConnman::NodeFullyConnected, which is defined in net.cpp. This can result in linker errors like so:https://travis-ci.org/bitcoin/bitcoin/jobs/379011082
The fix is to move
CNode's declaration aboveCConnmanin net.h, so thatCConnmancan make use ofCNodemembers in the method implementations, and moveNodeFullyConnectedfrom net.cpp to net.h.