Fixed unique ID generation

This commit is contained in:
WolverinDEV 2020-07-30 14:00:25 +02:00
parent 1e0c9eabe3
commit c60119af00
3 changed files with 23 additions and 2 deletions

View File

@ -151,6 +151,9 @@ void FileServerHandler::callback_transfer_statistics(const std::shared_ptr<trans
client->getConnectionStatistics()->logFileTransferOut(statistics.delta_file_bytes_transferred);
}
if(client->getType() == ClientType::CLIENT_TEAMSPEAK)
return; /* TS3 does not know this notify */
ts::command_builder notify{"notifyfiletransferprogress"};
notify.put_unchecked(0, "clientftfid", transfer->client_transfer_id);

View File

@ -864,6 +864,15 @@ command_result QueryClient::handleCommandServerSnapshotDeploy(Command& cmd) {
}
unique_lock server_create_lock(serverInstance->getVoiceServerManager()->server_create_lock);
{
auto instances = serverInstance->getVoiceServerManager()->serverInstances();
if(config::server::max_virtual_server != -1 && instances.size() > config::server::max_virtual_server)
return command_result{error::server_max_vs_reached, "You reached the via config.yml enabled virtual server limit."};
if(instances.size() >= 65535)
return command_result{error::server_max_vs_reached, "You cant create anymore virtual servers. (Software limit reached)"};
}
if(port == 0)
port = serverInstance->getVoiceServerManager()->next_available_port(host);
auto result = serverInstance->getVoiceServerManager()->createServerFromSnapshot(this->server, host, port, cmd, error);
@ -911,6 +920,16 @@ command_result QueryClient::handleCommandServerSnapshotDeployNew(const ts::comma
std::string error{};
unique_lock server_create_lock(serverInstance->getVoiceServerManager()->server_create_lock);
//TODO: Create a server if no exists
{ /* TODO: Only check if we're creating a new server */
auto instances = serverInstance->getVoiceServerManager()->serverInstances();
if(config::server::max_virtual_server != -1 && instances.size() > config::server::max_virtual_server)
return command_result{error::server_max_vs_reached, "You reached the via config.yml enabled virtual server limit."};
if(instances.size() >= 65535)
return command_result{error::server_max_vs_reached, "You cant create anymore virtual servers. (Software limit reached)"};
}
server_create_lock.unlock();
//TODO: Stop the server completely

View File

@ -148,11 +148,10 @@ CryptSetupHandler::CommandResult CryptSetupHandler::handleCommandClientInitIv(co
return ts::command_result{error::client_could_not_validate_identity};
}
client->properties()[property::CLIENT_UNIQUE_IDENTIFIER] = base64::encode(digest::sha1(clientOmega));
client->properties()[property::CLIENT_UNIQUE_IDENTIFIER] = base64::encode(digest::sha1(cmd.value("omega")));
}
this->new_protocol = !use_teaspeak && ot && config::experimental_31 && (this->client_protocol_time_ >= 173265950ULL || this->client_protocol_time_ == (uint32_t) 5680278000ULL);
this->new_protocol = true;
{
size_t server_seed_length = this->new_protocol ? 54 : 10;