From 900ca4311b107573150a72a530a8f18fda0e6ab8 Mon Sep 17 00:00:00 2001 From: Jaskowicz1 Date: Sat, 23 Sep 2023 20:43:09 +0100 Subject: [PATCH] fix: changed 5000 to 3 as time_t is seconds --- src/dpp/discordvoiceclient.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dpp/discordvoiceclient.cpp b/src/dpp/discordvoiceclient.cpp index 3edd04f850..bd90f5d3be 100644 --- a/src/dpp/discordvoiceclient.cpp +++ b/src/dpp/discordvoiceclient.cpp @@ -406,9 +406,14 @@ void discord_voice_client::thread_run() ssl_client::read_loop(); ssl_client::close(); - /* This will prevent us from looping too much, meaning error codes do not cause an infinite loop. */ time_t current_time = time(nullptr); - if(current_time - time_since_loop >= 5000) { + /* Here, we check if it's been longer than 3 seconds since the previous loop, + * this gives us time to see if it's an actual disconnect, or an error. + * This will prevent us from looping too much, meaning error codes do not cause an infinite loop. + */ + log(dpp::ll_debug, "current time: " + std::string(current_time)); + log(dpp::ll_debug, "time_since_loop: " + std::string(time_since_loop)); + if(current_time - time_since_loop >= 3000) { times_looped = 0; } /* This does mean we'll always have times_looped at a minimum of 1, this is intended. */