diff options
author | Anthony Towns <aj@erisian.com.au> | 2022-03-05 04:09:35 +1000 |
---|---|---|
committer | Anthony Towns <aj@erisian.com.au> | 2022-08-29 22:50:54 +1000 |
commit | bbec32c9ad2fe213314db9d39aa1eacff2e0bc23 (patch) | |
tree | 82087c39607c65f52f06b53546e9ec033766c9e0 /src/net.cpp | |
parent | 06ebdc886fcb4ca22f695bafe0956cff6d70a250 (diff) | |
download | bitcoin-bbec32c9ad2fe213314db9d39aa1eacff2e0bc23.tar.xz |
net: mark TransportSerializer/m_serializer as const
The (V1)TransportSerializer instance CNode::m_serializer is used from
multiple threads via PushMessage without protection by a mutex. This
is only thread safe because the class does not have any mutable state,
so document that by marking the methods and the object as "const".
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp index c2e45898e8..cf0c9aef7b 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -797,7 +797,8 @@ CNetMessage V1TransportDeserializer::GetMessage(const std::chrono::microseconds return msg; } -void V1TransportSerializer::prepareForTransport(CSerializedNetMsg& msg, std::vector<unsigned char>& header) { +void V1TransportSerializer::prepareForTransport(CSerializedNetMsg& msg, std::vector<unsigned char>& header) const +{ // create dbl-sha256 checksum uint256 hash = Hash(msg.data); |