[net] Delete CNetMessage copy constructor/assignment op

This commit is contained in:
dergoegge 2023-03-24 13:13:07 +01:00
parent 630756cac0
commit b5a85b365a

View file

@ -236,6 +236,14 @@ public:
std::string m_type; std::string m_type;
CNetMessage(CDataStream&& recv_in) : m_recv(std::move(recv_in)) {} 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) void SetVersion(int nVersionIn)
{ {