mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-22 22:34:15 +02:00
make scripted assignments passed in DS config static
This commit is contained in:
parent
d63374f656
commit
ce485c48b8
1 changed files with 14 additions and 8 deletions
|
@ -312,6 +312,8 @@ void DomainServer::createScriptedAssignmentsFromArray(const QJsonArray &configAr
|
||||||
int numInstances = jsonObject[ASSIGNMENT_INSTANCES_KEY].toInt();
|
int numInstances = jsonObject[ASSIGNMENT_INSTANCES_KEY].toInt();
|
||||||
numInstances = (numInstances == 0 ? 1 : numInstances);
|
numInstances = (numInstances == 0 ? 1 : numInstances);
|
||||||
|
|
||||||
|
qDebug() << "Adding a static scripted assignment from" << assignmentURL;
|
||||||
|
|
||||||
for (int i = 0; i < numInstances; i++) {
|
for (int i = 0; i < numInstances; i++) {
|
||||||
// add a scripted assignment to the queue for this instance
|
// add a scripted assignment to the queue for this instance
|
||||||
Assignment* scriptAssignment = new Assignment(Assignment::CreateCommand,
|
Assignment* scriptAssignment = new Assignment(Assignment::CreateCommand,
|
||||||
|
@ -319,13 +321,8 @@ void DomainServer::createScriptedAssignmentsFromArray(const QJsonArray &configAr
|
||||||
assignmentPool);
|
assignmentPool);
|
||||||
scriptAssignment->setPayload(assignmentURL.toUtf8());
|
scriptAssignment->setPayload(assignmentURL.toUtf8());
|
||||||
|
|
||||||
qDebug() << "Adding scripted assignment to queue -" << *scriptAssignment;
|
|
||||||
qDebug() << "URL for script is" << assignmentURL;
|
|
||||||
|
|
||||||
// scripts passed on CL or via JSON are static - so they are added back to the queue if the node dies
|
// scripts passed on CL or via JSON are static - so they are added back to the queue if the node dies
|
||||||
SharedAssignmentPointer sharedScriptAssignment(scriptAssignment);
|
addStaticAssignmentToAssignmentHash(scriptAssignment);
|
||||||
_unfulfilledAssignments.enqueue(sharedScriptAssignment);
|
|
||||||
_allAssignments.insert(sharedScriptAssignment->getUUID(), sharedScriptAssignment);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,7 +404,7 @@ void DomainServer::handleConnectRequest(const QByteArray& packet, const HifiSock
|
||||||
PendingAssignedNodeData* pendingAssigneeData = NULL;
|
PendingAssignedNodeData* pendingAssigneeData = NULL;
|
||||||
|
|
||||||
if (isAssignment) {
|
if (isAssignment) {
|
||||||
pendingAssigneeData = _pendingAssignedNodes.take(packetUUID);
|
pendingAssigneeData = _pendingAssignedNodes.value(packetUUID);
|
||||||
|
|
||||||
if (pendingAssigneeData) {
|
if (pendingAssigneeData) {
|
||||||
matchingQueuedAssignment = matchingQueuedAssignmentForCheckIn(pendingAssigneeData->getAssignmentUUID(), nodeType);
|
matchingQueuedAssignment = matchingQueuedAssignmentForCheckIn(pendingAssigneeData->getAssignmentUUID(), nodeType);
|
||||||
|
@ -416,12 +413,21 @@ void DomainServer::handleConnectRequest(const QByteArray& packet, const HifiSock
|
||||||
qDebug() << "Assignment deployed with" << uuidStringWithoutCurlyBraces(packetUUID)
|
qDebug() << "Assignment deployed with" << uuidStringWithoutCurlyBraces(packetUUID)
|
||||||
<< "matches unfulfilled assignment"
|
<< "matches unfulfilled assignment"
|
||||||
<< uuidStringWithoutCurlyBraces(matchingQueuedAssignment->getUUID());
|
<< uuidStringWithoutCurlyBraces(matchingQueuedAssignment->getUUID());
|
||||||
|
|
||||||
|
// remove this unique assignment deployment from the hash of pending assigned nodes
|
||||||
|
// cleanup of the PendingAssignedNodeData happens below after the node has been added to the LimitedNodeList
|
||||||
|
_pendingAssignedNodes.remove(packetUUID);
|
||||||
|
} else {
|
||||||
|
// this is a node connecting to fulfill an assignment that doesn't exist
|
||||||
|
// don't reply back to them so they cycle back and re-request an assignment
|
||||||
|
qDebug() << "No match for assignment deployed with" << uuidStringWithoutCurlyBraces(packetUUID);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!matchingQueuedAssignment && !_oauthProviderURL.isEmpty() && _argumentVariantMap.contains(ALLOWED_ROLES_CONFIG_KEY)) {
|
if (!isAssignment && !_oauthProviderURL.isEmpty() && _argumentVariantMap.contains(ALLOWED_ROLES_CONFIG_KEY)) {
|
||||||
// this is an Agent, and we require authentication so we can compare the user's roles to our list of allowed ones
|
// this is an Agent, and we require authentication so we can compare the user's roles to our list of allowed ones
|
||||||
if (_sessionAuthenticationHash.contains(packetUUID)) {
|
if (_sessionAuthenticationHash.contains(packetUUID)) {
|
||||||
if (!_sessionAuthenticationHash.value(packetUUID)) {
|
if (!_sessionAuthenticationHash.value(packetUUID)) {
|
||||||
|
|
Loading…
Reference in a new issue