mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-05-09 04:32:13 -05:00
Fix potential event sub freeze on disconnect
This commit is contained in:
parent
ab2762ebd3
commit
a5ecb7975e
|
|
@ -83,6 +83,10 @@ void EventSub::ConnectThread()
|
|||
} else {
|
||||
_client->connect(con);
|
||||
_connection = connection_hdl(con);
|
||||
if (_disconnect) {
|
||||
_client->close(con, websocketpp::close::status::normal,
|
||||
"Twitch EventSub stopping", ec);
|
||||
}
|
||||
_client->run();
|
||||
}
|
||||
|
||||
|
|
@ -157,12 +161,6 @@ void EventSub::Disconnect()
|
|||
_cv.notify_all();
|
||||
}
|
||||
|
||||
while (_connected) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
_client->close(_connection, websocketpp::close::status::normal,
|
||||
"Twitch EventSub stopping", ec);
|
||||
}
|
||||
|
||||
if (_thread.joinable()) {
|
||||
_thread.join();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ static bool setupTwitchTokenSupport()
|
|||
{
|
||||
AddSaveStep(saveConnections);
|
||||
AddLoadStep(loadConnections);
|
||||
AddPluginCleanupStep([]() { twitchTokens.clear(); });
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user