mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-20 00:05:41 -05:00
Disconnect Twitch chat and event connection on plugin stop
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "twitch-helpers.hpp"
|
||||
|
||||
#include <log-helper.hpp>
|
||||
#include <plugin-state-helpers.hpp>
|
||||
|
||||
#ifdef VERIFY_TIMESTAMPS
|
||||
#include "date/tz.h"
|
||||
@@ -71,6 +72,22 @@ void EventSub::UnregisterInstance()
|
||||
_instances.erase(it, _instances.end());
|
||||
}
|
||||
|
||||
void EventSub::DisconnectAll()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_instancesMtx);
|
||||
for (auto *instance : _instances) {
|
||||
instance->Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
static bool setupEventSubSupport()
|
||||
{
|
||||
AddStopStep(EventSub::DisconnectAll);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool _eventSubSetup = setupEventSubSupport();
|
||||
|
||||
void EventSub::ConnectThread()
|
||||
{
|
||||
_client->reset();
|
||||
|
||||
Reference in New Issue
Block a user