Fixed an abort

This commit is contained in:
WolverinDEV 2020-12-15 23:21:20 +01:00
parent 644391f58a
commit 4fddc87866

View File

@ -171,8 +171,9 @@ bool VoiceClient::close_connection(const system_clock::time_point &timeout) {
{
std::lock_guard state_lock{this->state_lock};
if(this->state == ConnectionState::DISCONNECTED) return false;
else if(this->state == ConnectionState::DISCONNECTING) {
if(this->state == ConnectionState::DISCONNECTED) {
return false;
} else if(this->state == ConnectionState::DISCONNECTING) {
/* here is nothing to pay attention for */
} else if(this->state == ConnectionState::DISCONNECTING_FLUSHING) {
if(!flush) {
@ -188,6 +189,10 @@ bool VoiceClient::close_connection(const system_clock::time_point &timeout) {
debugMessage(this->getServerId(), "{} Closing voice client connection. (Flush: {})", CLIENT_STR_LOG_PREFIX, flush);
//TODO: Move this out into a thread pool?
if(this->flushing_thread->joinable()) {
logCritical(LOG_GENERAL, "VoiceClient::close_connection reached flushing thread with an active old handle. Ignoring request.");
return true;
}
this->flushing_thread = std::make_shared<std::thread>([this, self_lock, timeout, flush]{
{