-
Notifications
You must be signed in to change notification settings - Fork 38.7k
refactor: Group and re-order CAddrMan members by access type #22025
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. 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. |
vasild
left a 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.
ACK 6627b0b
vasild
left a 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.
ACK 1b177a4
|
ACK 1b177a4 |
src/addrman.h
Outdated
| //! Update an entry's service bits. | ||
| void SetServices_(const CService &addr, ServiceFlags nServices) EXCLUSIVE_LOCKS_REQUIRED(cs); | ||
|
|
||
| friend class CAddrManCorrupted; |
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.
Sorry but I'm not 100% sure that having this class know about all descendents in the tests is better than using protected.
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.
Currently, one derived testing class has the friend specifier, others have access to protected members.
Is combining both approaches better?
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.
I'd say that if there is a choice, using protected is better than explicitly naming every descendant. Ideally you'd be able to add tests without having to mention them in the code to be tested. friend is like a last resort option for otherwise unrelated classes.
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.
I see.
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.
Thanks! Updated.
Easy to verify with `git diff --color-moved=dimmed-zebra`.
|
Updated 1b177a4 -> 8caf60d (pr22025.02 -> pr22025.03, diff): |
|
ACK 8caf60d |
|
Concept ACK |
jarolrod
left a 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.
ACK 8caf60d
Patch looks correct
vasild
left a 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.
ACK 8caf60d
|
Code review ACK 8caf60d |
ae98aec refactor: Make CAddrMan::cs non-recursive (Hennadii Stepanov) f5d1c7f Add AssertLockHeld to CAddrMan private functions (Hennadii Stepanov) 5ef1d0b Add thread safety annotations to CAddrMan public functions (Hennadii Stepanov) b138973 refactor: Avoid recursive locking in CAddrMan::Clear (Hennadii Stepanov) f79a664 refactor: Apply consistent pattern for CAddrMan::Check usage (Hennadii Stepanov) 187b7d2 refactor: Avoid recursive locking in CAddrMan::Check (Hennadii Stepanov) f77d9c7 refactor: Fix CAddrMan::Check style (Hennadii Stepanov) 0670397 Make CAddrMan::Check private (Hennadii Stepanov) efc6fac refactor: Avoid recursive locking in CAddrMan::size (Hennadii Stepanov) 2da9554 test: Drop excessive locking in CAddrManTest::SimConnFail (Hennadii Stepanov) Pull request description: This PR replaces `RecursiveMutex CAddrMan::cs` with `Mutex CAddrMan::cs`. All of the related code branches are covered by appropriate lock assertions to insure that the mutex locking policy has not been changed by accident. Related to #19303. Based on #22025, and first three commits belong to it. ACKs for top commit: vasild: ACK ae98aec Tree-SHA512: c3a2d3d955a75befd7e497a802b8c10730e393be9111ca263ad0464d32fae6c7edf9bd173ffb6bc9bb61c4b39073a74eba12979d47f26b0b7b4a861d100942df
This PR is split from #19238 as all of its commits are trivial to review.
The last commit is easy to review with
git diff --color-moved=dimmed-zebra.Addressed the following comments from #19238: