Added another debug possibility

This commit is contained in:
WolverinDEV 2020-04-02 19:24:57 +02:00
parent b594c9566c
commit ca2de244d8
2 changed files with 24 additions and 2 deletions

View File

@ -641,12 +641,34 @@ bool ConnectedClient::handle_text_command(
auto id = vc->getConnection()->getPacketIdManager().currentPacketId(type);
auto gen = vc->getConnection()->getPacketIdManager().generationId(type);
auto genestis = vc->getConnection()->get_incoming_generation_estimators();
auto& genestis = vc->getConnection()->get_incoming_generation_estimators();
send_message(_this.lock(), " OUT " + type.name() + " => generation: " + to_string(gen) + " id: " + to_string(id));
send_message(_this.lock(), " IN " + type.name() + " => generation: " + to_string(genestis[type.type()].generation()) + " id: " + to_string(genestis[type.type()].current_packet_id()));
}
return true;
} else if(TARG(0, "sgeneration")) {
TLEN(4);
try {
auto type = stol(arguments[1]);
auto generation = stol(arguments[2]);
auto pid = stol(arguments[3]);
auto vc = dynamic_pointer_cast<VoiceClient>(_this.lock());
if(!vc) return false;
auto& genestis = vc->getConnection()->get_incoming_generation_estimators();
if(type >= genestis.size()) {
send_message(_this.lock(), "Invalid type");
return true;
}
genestis[type].set_last_state(pid, generation);
} catch(std::exception& ex) {
send_message(_this.lock(), "Failed to parse argument");
return true;
}
return true;
} else if(TARG(0, "disconnect")) {
auto vc = dynamic_pointer_cast<VoiceClient>(_this.lock());
if(!vc) return false;

View File

@ -82,7 +82,7 @@ namespace ts {
bool wait_empty_write_and_prepare_queue(std::chrono::time_point<std::chrono::system_clock> until = std::chrono::time_point<std::chrono::system_clock>());
protocol::PacketIdManager& getPacketIdManager() { return this->packet_id_manager; }
inline auto get_incoming_generation_estimators() { return this->incoming_generation_estimators; }
inline auto& get_incoming_generation_estimators() { return this->incoming_generation_estimators; }
void reset();
void force_insert_command(const pipes::buffer_view& /* payload */);