Skip to content

Commit

Permalink
fix: changed 5000 to 3 as time_t is seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaskowicz1 committed Sep 23, 2023
1 parent 82d30a3 commit 900ca43
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/dpp/discordvoiceclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 900ca43

Please sign in to comment.