#pragma once #include #include namespace ts::server { class VoiceClient; } namespace ts::server::server::udp { struct ReassembledCommand; class ServerCommandExecutor { public: explicit ServerCommandExecutor(VoiceClient*); ~ServerCommandExecutor(); void reset(); void force_insert_command(const pipes::buffer_view& /* payload */); void enqueue_command_execution(ReassembledCommand*); /* Attention: The method will take ownership of the command */ void execute_handle_command_packets(const std::chrono::system_clock::time_point& /* scheduled */); private: VoiceClient* client; spin_mutex pending_commands_lock{}; ReassembledCommand* pending_commands_head{nullptr}; ReassembledCommand** pending_commands_tail{&pending_commands_head}; bool has_command_handling_scheduled{false}; /* locked by pending_commands_lock */ }; struct ReassembledCommand; }