remove recursion

This commit is contained in:
EinTim23 2024-11-04 22:53:19 +01:00
parent f65e4b7269
commit 06ce971112
1 changed files with 15 additions and 13 deletions

View File

@ -20,20 +20,22 @@ std::string currentSongTitle = "";
void handleRPCTasks() { void handleRPCTasks() {
while (true) { while (true) {
DiscordEventHandlers discordHandler{}; while (true) {
auto app = utils::getApp(lastMediaSource); DiscordEventHandlers discordHandler{};
Discord_Initialize(app.clientId.c_str(), &discordHandler); auto app = utils::getApp(lastMediaSource);
if (Discord_IsConnected()) Discord_Initialize(app.clientId.c_str(), &discordHandler);
break; if (Discord_IsConnected())
break;
std::this_thread::sleep_for(std::chrono::seconds(1));
}
while (true) {
Discord_RunCallbacks();
if (!Discord_IsConnected())
break;
std::this_thread::sleep_for(std::chrono::seconds(1));
}
Discord_Shutdown();
} }
while (true) {
Discord_RunCallbacks();
if (!Discord_IsConnected())
break;
std::this_thread::sleep_for(std::chrono::seconds(1));
}
Discord_Shutdown();
handleRPCTasks(); // this could theoretically cause a stack overflow if discord is restarted often enough
} }
void handleMediaTasks() { void handleMediaTasks() {