Fixed the virtual server snapshot port persistance
This commit is contained in:
parent
d5ce71b769
commit
7fdd272d76
@ -20,9 +20,7 @@ using namespace ts;
|
||||
using namespace ts::server;
|
||||
using namespace ts::token;
|
||||
|
||||
extern ts::server::InstanceHandler* serverInstance;
|
||||
|
||||
#define INVOKER(command, invoker) \
|
||||
# define INVOKER(command, invoker) \
|
||||
do { \
|
||||
if(invoker) { \
|
||||
command["invokerid"] = invoker->getClientId(); \
|
||||
|
@ -714,8 +714,9 @@ command_result ConnectedClient::handleCommandBanAdd(Command &cmd) {
|
||||
return command_result{permission::b_client_ban_create};
|
||||
}
|
||||
|
||||
auto max_ban_time = this->calculate_permission(permission::i_client_ban_max_bantime, this->getClientDatabaseId(), this->getType(), 0);
|
||||
if(!max_ban_time.has_value) return command_result{permission::i_client_ban_max_bantime};
|
||||
auto max_ban_time = this->calculate_permission(permission::i_client_ban_max_bantime, this->getClientDatabaseId());
|
||||
if(!max_ban_time.has_value)
|
||||
return command_result{permission::i_client_ban_max_bantime};
|
||||
if (!max_ban_time.has_infinite_power()) {
|
||||
if (max_ban_time.value < time)
|
||||
return command_result{permission::i_client_ban_max_bantime};
|
||||
|
@ -34,11 +34,13 @@ VirtualServerManager::SnapshotDeployResult VirtualServerManager::deploy_snapshot
|
||||
return SnapshotDeployResult::REACHED_SERVER_ID_LIMIT;
|
||||
}
|
||||
|
||||
std::string server_host{server ? server->properties()[property::VIRTUALSERVER_HOST].value() : config::binding::DefaultVoiceHost};
|
||||
uint16_t server_port{server ? server->properties()[property::VIRTUALSERVER_PORT].as<uint16_t>() : this->next_available_port(server_host)};
|
||||
this->delete_server_in_db(kSnapshotServerId, false);
|
||||
auto result = sql::command{this->handle->getSql(), "INSERT INTO `servers` (`serverId`, `host`, `port`) VALUES (:sid, :host, :port)"}
|
||||
.value(":sid", kSnapshotServerId)
|
||||
.value(":host", server ? server->properties()[property::VIRTUALSERVER_HOST].value() : config::binding::DefaultVoiceHost)
|
||||
.value(":port", server ? server->properties()[property::VIRTUALSERVER_PORT].as<uint16_t>() : config::voice::default_voice_port)
|
||||
.value(":host", server_host)
|
||||
.value(":port", server_port)
|
||||
.execute();
|
||||
|
||||
if(!result) {
|
||||
@ -63,6 +65,8 @@ VirtualServerManager::SnapshotDeployResult VirtualServerManager::deploy_snapshot
|
||||
if(!server->initialize(true)) {
|
||||
//FIXME error handling
|
||||
}
|
||||
server->properties()[property::VIRTUALSERVER_HOST] = server_host;
|
||||
server->properties()[property::VIRTUALSERVER_PORT] = server_port;
|
||||
|
||||
server->properties()[property::VIRTUALSERVER_ASK_FOR_PRIVILEGEKEY] = false;
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user