The second and last change on this topic (c.f. #15109). Split up because the diff would otherwise interleave, making review harder than necessary.
This is not a stylistic change, but a change that avoids bugs such as:
The second and last change on this topic (c.f. #15109). Split up because the diff would otherwise interleave, making review harder than necessary.
This is not a stylistic change, but a change that avoids bugs such as:
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, 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.
Concept ACK. Will review.
646 | - size_t nSendSize; // total size of all vSendMsg entries 647 | - size_t nSendOffset; // offset inside the first vSendMsg already sent 648 | - uint64_t nSendBytes GUARDED_BY(cs_vSend); 649 | + size_t nSendSize{0}; // total size of all vSendMsg entries 650 | + size_t nSendOffset{0}; // offset inside the first vSendMsg already sent 651 | + uint64_t nSendBytes GUARDED_BY(cs_vSend){0};
I'm all for brace initialisation in the general case, but in this case what about using ...
uint64_t nSendBytes = 0 GUARDED_BY(cs_vSend);
... to make it clear that 0 has nothing to do with GUARDED_BY(cs_vSend)?
Applies for the other member variables with GUARDED_BY(…):s.
I prefer consistency, and maybe a space around the annotation would look better:
uint64_t nSendBytes GUARDED_BY(cs_vSend) {0};
@promag Yes, space is better.
According to clang-format there should be no space
Oh, TIL! Then we'll simply go with what clang-format prefers.
755 | // Last measured round-trip time. 756 | - std::atomic<int64_t> nPingUsecTime; 757 | + std::atomic<int64_t> nPingUsecTime{0}; 758 | // Best measured round-trip time. 759 | - std::atomic<int64_t> nMinPingUsecTime; 760 | + std::atomic<int64_t> nMinPingUsecTime{std::numeric_limits<int64_t>::max()};
#include <limits>
ACK fac2f5e:
utACK fac2f5ecae96dd11057977ce988501e18bb162c6
2819 | - nSendBytes = 0; 2820 | - nRecvBytes = 0; 2821 | - nTimeOffset = 0; 2822 | addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; 2823 | - nVersion = 0; 2824 | strSubVer = "";
Remove this redundant line? :-)
utACK fac2f5ecae96dd11057977ce988501e18bb162c6