From ef26f2f421071986a3878a1a94b0149ae8e16fcd Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Fri, 20 May 2022 05:37:54 +1000 Subject: net: mark CNode unique_ptr members as const Dereferencing a unique_ptr is not necessarily thread safe. The reason these are safe is because their values are set at construction and do not change later; so mark them as const and set them via the initializer list to guarantee that. --- src/net.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index 97389314b2..d062b8a9ff 100644 --- a/src/net.h +++ b/src/net.h @@ -341,8 +341,8 @@ class CNode friend struct ConnmanTestMsg; public: - std::unique_ptr m_deserializer; - std::unique_ptr m_serializer; + const std::unique_ptr m_deserializer; // Used only by SocketHandler thread + const std::unique_ptr m_serializer; NetPermissionFlags m_permissionFlags{NetPermissionFlags::None}; -- cgit v1.2.3