Tryfix again

This commit is contained in:
WolverinDEV 2020-03-28 23:08:11 +01:00
parent f596151c42
commit 63219434d3
3 changed files with 14 additions and 5 deletions

@ -1 +1 @@
Subproject commit 5f28af18dabd2ee8f3370bf564c1e287acad3af2
Subproject commit 309dfed173cdcc46e10d2ec6a1683ff79895539b

View File

@ -252,7 +252,7 @@ void VoiceClientConnection::execute_handle_command_packets(const std::chrono::sy
buffer_execute_lock.unlock();
auto voice_server = this->client->voice_server;
if(voice_server && reexecute_handle)
if(voice_server && (reexecute_handle || this->should_reassembled_reschedule))
this->client->voice_server->schedule_command_handling(this->client);
}
@ -267,13 +267,19 @@ bool VoiceClientConnection::next_reassembled_command(unique_lock<std::recursive_
/* handle commands before command low packets */
for(auto& buf : this->_command_fragment_buffers) {
unique_lock ring_lock(buf.buffer_lock/*, try_to_lock */); //Perm lock the buffer else, may command wount get handeled. Because we've more left, but say we waven't
if(!ring_lock.owns_lock()) continue;
unique_lock ring_lock(buf.buffer_lock, try_to_lock); //Perm lock the buffer else, may command wount get handeled. Because we've more left, but say we waven't
if(!ring_lock.owns_lock()) {
this->should_reassembled_reschedule = true;
continue;
}
if(buf.front_set()) {
if(!buffer) { /* lets still test for reexecute */
buffer_execute_lock = unique_lock(buf.execute_lock, try_to_lock);
if(!buffer_execute_lock.owns_lock()) continue;
if(!buffer_execute_lock.owns_lock()) {
this->should_reassembled_reschedule = true;
continue;
}
buffer_lock = move(ring_lock);
buffer = &buf;
@ -368,6 +374,7 @@ bool VoiceClientConnection::next_reassembled_command(unique_lock<std::recursive_
}
result = std::move(payload);
logTrace(0, "Element: {} Resched: {}", result.view(0, 18).string(), have_more);
return have_more;
}

View File

@ -100,6 +100,8 @@ namespace ts {
CompressionHandler compress_handler;
AcknowledgeManager acknowledge_handler;
std::atomic_bool should_reassembled_reschedule; /* this get checked as soon the command handle lock has been released so trylock will succeed */
//Handle stuff
void execute_handle_command_packets(const std::chrono::system_clock::time_point& /* scheduled */);
bool next_reassembled_command(std::unique_lock<std::recursive_timed_mutex> &buffer_execute_lock /* packet channel execute lock */, pipes::buffer & /* buffer*/, uint16_t& /* packet id */);