Fixed a command packet order issue

This commit is contained in:
WolverinDEV 2019-07-21 14:56:53 +02:00
parent a5e545afeb
commit c9e257270f
5 changed files with 15 additions and 4 deletions

View File

@ -620,7 +620,12 @@ inline void send_channels(ConnectedClient* client, ChannelIT begin, const Channe
if(++index > 6) if(++index > 6)
break; break;
} }
client->sendCommand(channellist); if(dynamic_cast<VoiceClient*>(client)) {
auto vc = dynamic_cast<VoiceClient*>(client);
vc->sendCommand0(channellist, false, true); /* we need to process this command directly so it will be processed before the channellistfinished stuff */
} else {
client->sendCommand(channellist);
}
if(begin != end) if(begin != end)
send_channels(client, begin, end, override_orderid); send_channels(client, begin, end, override_orderid);
} }

View File

@ -121,6 +121,7 @@ namespace ts {
bool isAddressV6() { return this->remote_address.ss_family == AF_INET6; } bool isAddressV6() { return this->remote_address.ss_family == AF_INET6; }
const sockaddr_in6* getAddressV6(){ return (sockaddr_in6*) &this->remote_address; } const sockaddr_in6* getAddressV6(){ return (sockaddr_in6*) &this->remote_address; }
/* Note: Order is not guaranteed here! */
virtual void sendCommand(const ts::Command& command, bool low = false) = 0; virtual void sendCommand(const ts::Command& command, bool low = false) = 0;
//General manager stuff //General manager stuff

View File

@ -3313,8 +3313,12 @@ CommandResult ConnectedClient::handleCommandFTGetFileList(Command &cmd) {
} }
if (fileList[0].has("name")) { if (fileList[0].has("name")) {
this->sendCommand(fileList); if(dynamic_cast<VoiceClient*>(this)) {
if (this->getExternalType() == CLIENT_TEAMSPEAK) this->sendCommand(fileListFinished); dynamic_cast<VoiceClient*>(this)->sendCommand0(fileList, false, true); /* We need to process this directly else the order could get shuffeled up! */
this->sendCommand(fileListFinished);
} else {
this->sendCommand(fileList);
}
return CommandResult::Success; return CommandResult::Success;
} else { } else {
return {findError("database_empty_result"), "empty"}; return {findError("database_empty_result"), "empty"};

View File

@ -55,6 +55,7 @@ namespace ts {
bool disconnect(ViewReasonId /* reason type */, const std::string& /* reason */, const std::shared_ptr<ts::server::ConnectedClient>& /* invoker */, bool /* notify viewer */); bool disconnect(ViewReasonId /* reason type */, const std::string& /* reason */, const std::shared_ptr<ts::server::ConnectedClient>& /* invoker */, bool /* notify viewer */);
virtual void sendCommand(const ts::Command &command, bool low = false) { return this->sendCommand0(command, low); } virtual void sendCommand(const ts::Command &command, bool low = false) { return this->sendCommand0(command, low); }
/* Note: Order is only guaranteed if progressDirectly is on! */
virtual void sendCommand0(const ts::Command &command, bool low = false, bool progressDirectly = false, std::unique_ptr<threads::Future<bool>> listener = nullptr); virtual void sendCommand0(const ts::Command &command, bool low = false, bool progressDirectly = false, std::unique_ptr<threads::Future<bool>> listener = nullptr);
virtual void sendAcknowledge(uint16_t packetId, bool low = false); virtual void sendAcknowledge(uint16_t packetId, bool low = false);

2
shared

@ -1 +1 @@
Subproject commit 9833dab6e4f96c045da632c208aa1bc977d45349 Subproject commit a0cca36eca11da410626a340dbe4377067d59c1b