mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Make min and max dynamic verification times server settings
This commit is contained in:
parent
c70ee6055f
commit
8d887caa5d
3 changed files with 45 additions and 6 deletions
|
@ -98,7 +98,8 @@ void EntityServer::beforeRun() {
|
||||||
const int PRUNE_DELETED_MODELS_INTERVAL_MSECS = 1 * 1000; // once every second
|
const int PRUNE_DELETED_MODELS_INTERVAL_MSECS = 1 * 1000; // once every second
|
||||||
_pruneDeletedEntitiesTimer->start(PRUNE_DELETED_MODELS_INTERVAL_MSECS);
|
_pruneDeletedEntitiesTimer->start(PRUNE_DELETED_MODELS_INTERVAL_MSECS);
|
||||||
|
|
||||||
startDynamicDomainVerification();
|
DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler();
|
||||||
|
connect(&domainHandler, &DomainHandler::settingsReceiveFail, this, &EntityServer::domainSettingsRequestFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityServer::entityCreated(const EntityItem& newEntity, const SharedNodePointer& senderNode) {
|
void EntityServer::entityCreated(const EntityItem& newEntity, const SharedNodePointer& senderNode) {
|
||||||
|
@ -302,6 +303,18 @@ void EntityServer::readAdditionalConfiguration(const QJsonObject& settingsSectio
|
||||||
tree->setEntityMaxTmpLifetime(EntityTree::DEFAULT_MAX_TMP_ENTITY_LIFETIME);
|
tree->setEntityMaxTmpLifetime(EntityTree::DEFAULT_MAX_TMP_ENTITY_LIFETIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int minTime;
|
||||||
|
if (readOptionInt("dynamicDomainVerificationTimeMin", settingsSectionObject, minTime)) {
|
||||||
|
_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = minTime * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
int maxTime;
|
||||||
|
if (readOptionInt("dynamicDomainVerificationTimeMax", settingsSectionObject, maxTime)) {
|
||||||
|
_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = maxTime * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
startDynamicDomainVerification();
|
||||||
|
|
||||||
tree->setWantEditLogging(wantEditLogging);
|
tree->setWantEditLogging(wantEditLogging);
|
||||||
tree->setWantTerseEditLogging(wantTerseEditLogging);
|
tree->setWantTerseEditLogging(wantTerseEditLogging);
|
||||||
|
|
||||||
|
@ -417,6 +430,15 @@ QString EntityServer::serverSubclassStats() {
|
||||||
return statsString;
|
return statsString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityServer::domainSettingsRequestFailed() {
|
||||||
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
qCDebug(entities) << "The EntityServer couldn't get the Domain Settings. Starting dynamic domain verification with default values...";
|
||||||
|
|
||||||
|
_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = DEFAULT_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS;
|
||||||
|
_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = DEFAULT_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS;
|
||||||
|
startDynamicDomainVerification();
|
||||||
|
}
|
||||||
|
|
||||||
void EntityServer::startDynamicDomainVerification() {
|
void EntityServer::startDynamicDomainVerification() {
|
||||||
qCDebug(entities) << "Starting Dynamic Domain Verification...";
|
qCDebug(entities) << "Starting Dynamic Domain Verification...";
|
||||||
|
|
||||||
|
@ -474,7 +496,7 @@ void EntityServer::startDynamicDomainVerification() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int nextInterval = qrand() % ((MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS + 1) - MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS) + MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS;
|
int nextInterval = qrand() % ((_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS + 1) - _MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS) + _MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS;
|
||||||
qCDebug(entities) << "Restarting Dynamic Domain Verification timer for" << nextInterval / 1000 << "seconds";
|
qCDebug(entities) << "Restarting Dynamic Domain Verification timer for" << nextInterval / 1000 << "seconds";
|
||||||
_dynamicDomainVerificationTimer.start(nextInterval);
|
_dynamicDomainVerificationTimer.start(nextInterval);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ protected:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleEntityPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
|
void handleEntityPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
|
||||||
|
void domainSettingsRequestFailed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SimpleEntitySimulationPointer _entitySimulation;
|
SimpleEntitySimulationPointer _entitySimulation;
|
||||||
|
@ -81,10 +82,10 @@ private:
|
||||||
QReadWriteLock _viewerSendingStatsLock;
|
QReadWriteLock _viewerSendingStatsLock;
|
||||||
QMap<QUuid, QMap<QUuid, ViewerSendingStats>> _viewerSendingStats;
|
QMap<QUuid, QMap<QUuid, ViewerSendingStats>> _viewerSendingStats;
|
||||||
|
|
||||||
//static const int MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = 45 * 60 * 1000; // 45m
|
static const int DEFAULT_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = 45 * 60 * 1000; // 45m
|
||||||
//static const int MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = 75 * 60 * 1000; // 1h15m
|
static const int DEFAULT_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = 75 * 60 * 1000; // 1h15m
|
||||||
static const int MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = 5 * 1000; // 5s
|
int _MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = DEFAULT_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS; // 45m
|
||||||
static const int MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = 10 * 1000; // 10s
|
int _MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = DEFAULT_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS; // 1h15m
|
||||||
QTimer _dynamicDomainVerificationTimer;
|
QTimer _dynamicDomainVerificationTimer;
|
||||||
void startDynamicDomainVerification();
|
void startDynamicDomainVerification();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1254,6 +1254,22 @@
|
||||||
"default": "3600",
|
"default": "3600",
|
||||||
"advanced": true
|
"advanced": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "dynamicDomainVerificationTimeMin",
|
||||||
|
"label": "Dynamic Domain Verification Time (seconds) - Minimum",
|
||||||
|
"help": "The lower limit on the amount of time that passes before Dynamic Domain Verification on entities occurs. Units are seconds.",
|
||||||
|
"placeholder": "2700",
|
||||||
|
"default": "2700",
|
||||||
|
"advanced": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dynamicDomainVerificationTimeMax",
|
||||||
|
"label": "Dynamic Domain Verification Time (seconds) - Maximum",
|
||||||
|
"help": "The upper limit on the amount of time that passes before Dynamic Domain Verification on entities occurs. Units are seconds.",
|
||||||
|
"placeholder": "4500",
|
||||||
|
"default": "4500",
|
||||||
|
"advanced": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "entityScriptSourceWhitelist",
|
"name": "entityScriptSourceWhitelist",
|
||||||
"label": "Entity Scripts Allowed from:",
|
"label": "Entity Scripts Allowed from:",
|
||||||
|
|
Loading…
Reference in a new issue