Skip to content

Commit 9816dc9

Browse files
committed
net: note CNode members that are treated as const
m_permissionFlags and m_prefer_evict are treated as const -- they're only set immediately after construction before any other thread has access to the object, and not changed again afterwards. As such they don't need to be marked atomic or guarded by a mutex; though it would probably be better to actually mark them as const...
1 parent ef26f2f commit 9816dc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/net.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ class CNode
344344
const std::unique_ptr<TransportDeserializer> m_deserializer; // Used only by SocketHandler thread
345345
const std::unique_ptr<const TransportSerializer> m_serializer;
346346

347-
NetPermissionFlags m_permissionFlags{NetPermissionFlags::None};
347+
NetPermissionFlags m_permissionFlags{NetPermissionFlags::None}; // treated as const outside of fuzz tester
348348

349349
/**
350350
* Socket used for communication with the node.
@@ -393,7 +393,7 @@ class CNode
393393
* from the wire. This cleaned string can safely be logged or displayed.
394394
*/
395395
std::string cleanSubVer GUARDED_BY(m_subver_mutex){};
396-
bool m_prefer_evict{false}; // This peer is preferred for eviction.
396+
bool m_prefer_evict{false}; // This peer is preferred for eviction. (treated as const)
397397
bool HasPermission(NetPermissionFlags permission) const {
398398
return NetPermissions::HasFlag(m_permissionFlags, permission);
399399
}

0 commit comments

Comments
 (0)