aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authordergoegge <n.goeggi@gmail.com>2023-03-24 13:13:07 +0100
committerdergoegge <n.goeggi@gmail.com>2023-03-27 16:00:01 +0200
commitb5a85b365a4abd98176b0935015dbb502cc3e6f6 (patch)
tree712b2915eb2f5b766359abcddf77ccc717833eca /src/net.h
parent630756cac0734df34e347bc5745c72d8ee521b09 (diff)
[net] Delete CNetMessage copy constructor/assignment op
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/net.h b/src/net.h
index 7bb164003e..6eb35cbe13 100644
--- a/src/net.h
+++ b/src/net.h
@@ -236,6 +236,14 @@ public:
std::string m_type;
CNetMessage(CDataStream&& recv_in) : m_recv(std::move(recv_in)) {}
+ // Only one CNetMessage object will exist for the same message on either
+ // the receive or processing queue. For performance reasons we therefore
+ // delete the copy constructor and assignment operator to avoid the
+ // possibility of copying CNetMessage objects.
+ CNetMessage(CNetMessage&&) = default;
+ CNetMessage(const CNetMessage&) = delete;
+ CNetMessage& operator=(CNetMessage&&) = default;
+ CNetMessage& operator=(const CNetMessage&) = delete;
void SetVersion(int nVersionIn)
{