From b925836c2c27bb2eceecfacb612e6205050d0158 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Fri, 10 Oct 2025 20:06:58 -0500 Subject: [PATCH] feat(net): add NETEVENTQUEUE dtor --- src/net/connection/NetClient.cpp | 12 ++++++++++++ src/net/connection/NetClient.hpp | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/net/connection/NetClient.cpp b/src/net/connection/NetClient.cpp index 531f122..97712af 100644 --- a/src/net/connection/NetClient.cpp +++ b/src/net/connection/NetClient.cpp @@ -20,6 +20,10 @@ void InitializePropContext() { } } +NETEVENTQUEUE::~NETEVENTQUEUE() { + this->Clear(); +} + void NETEVENTQUEUE::AddEvent(EVENTID eventId, void* conn, NetClient* client, const void* data, uint32_t bytes) { this->m_critSect.Enter(); @@ -43,6 +47,14 @@ void NETEVENTQUEUE::AddEvent(EVENTID eventId, void* conn, NetClient* client, con this->m_critSect.Leave(); } +void NETEVENTQUEUE::Clear() { + this->m_critSect.Enter(); + + this->m_eventQueue.Clear(); + + this->m_critSect.Leave(); +} + void NETEVENTQUEUE::Poll() { this->m_critSect.Enter(); diff --git a/src/net/connection/NetClient.hpp b/src/net/connection/NetClient.hpp index 8e04b22..f9f0458 100644 --- a/src/net/connection/NetClient.hpp +++ b/src/net/connection/NetClient.hpp @@ -41,7 +41,9 @@ class NETEVENTQUEUE { NETEVENTQUEUE(NetClient* client) : m_client(client) {}; + ~NETEVENTQUEUE(); void AddEvent(EVENTID eventId, void* conn, NetClient* client, const void* data, uint32_t bytes); + void Clear(); void Poll(); };