From 2331374d1ffe2432496e484443a58e859a7f560f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 16 Feb 2025 16:56:14 +0300 Subject: Discord: the safer way of handling web sockets --- protocols/Discord/src/proto.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'protocols/Discord/src/proto.cpp') diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index f1df2c2a12..5a33a9d6f5 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -44,6 +44,7 @@ static int compareCalls(const CDiscordVoiceCall *p1, const CDiscordVoiceCall *p2 CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) : PROTO(proto_name, username), + m_ws(this), m_impl(*this), m_arHttpQueue(10, compareRequests), m_evRequestsQueue(CreateEvent(nullptr, FALSE, FALSE, nullptr)), @@ -174,8 +175,8 @@ void CDiscordProto::OnShutdown() for (auto &it : arGuilds) it->SaveToFile(); - if (m_ws) - m_ws->terminate(); + if (m_bConnected) + m_ws.terminate(); if (g_plugin.bVoiceService) CallService(MS_VOICESERVICE_UNREGISTER, (WPARAM)m_szModuleName, 0); -- cgit v1.2.3