diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-07-11 01:27:47 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-07-11 01:27:47 -0400 |
commit | f5e78c899a21835dd6673286acd1fa790884ee19 (patch) | |
tree | 8ea4d3ef16df783ca6a8654f0a88d95c00ac08f9 /discord | |
parent | 41bd2334faa2569aa8826dcb1ddfe42c4c6d4118 (diff) | |
download | abaddon-portaudio-f5e78c899a21835dd6673286acd1fa790884ee19.tar.gz abaddon-portaudio-f5e78c899a21835dd6673286acd1fa790884ee19.zip |
more reliable menu sensitivty/actions
Diffstat (limited to 'discord')
-rw-r--r-- | discord/discord.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/discord/discord.cpp b/discord/discord.cpp index 9e620e3..fab2c49 100644 --- a/discord/discord.cpp +++ b/discord/discord.cpp @@ -24,6 +24,8 @@ DiscordClient::DiscordClient(bool mem_store) } void DiscordClient::Start() { + if (m_client_started) return; + m_http.SetBase(GetAPIURL()); std::memset(&m_zstream, 0, sizeof(m_zstream)); @@ -37,22 +39,22 @@ void DiscordClient::Start() { } void DiscordClient::Stop() { - m_client_started = false; + if (m_client_started) { + inflateEnd(&m_zstream); + m_compressed_buf.clear(); - if (!m_client_connected) return; - - inflateEnd(&m_zstream); - m_compressed_buf.clear(); + m_heartbeat_waiter.kill(); + if (m_heartbeat_thread.joinable()) m_heartbeat_thread.join(); + m_client_connected = false; + m_reconnecting = false; - m_heartbeat_waiter.kill(); - if (m_heartbeat_thread.joinable()) m_heartbeat_thread.join(); - m_client_connected = false; - m_reconnecting = false; + m_store.ClearAll(); + m_guild_to_users.clear(); - m_store.ClearAll(); - m_guild_to_users.clear(); + m_websocket.Stop(); + } - m_websocket.Stop(); + m_client_started = false; } bool DiscordClient::IsStarted() const { |