net: Add Clang thread safety annotations for guarded variables in the networking code
Summary:
- Add missing lock in CNode::copyStats(...)
- Add missing locking annotations
This is a backport of Core PR13123
Depends on D4083
Test Plan:
cmake -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. ninja
Check that there are no thread safety analysis warnings.
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D4084