mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 17:24:24 +02:00
Merge pull request #2704 from birarda/master
correct the re-assignment of static assignments
This commit is contained in:
commit
2491b75be4
2 changed files with 30 additions and 25 deletions
|
@ -344,7 +344,6 @@ const NodeSet STATICALLY_ASSIGNED_NODES = NodeSet() << NodeType::AudioMixer
|
||||||
<< NodeType::AvatarMixer << NodeType::VoxelServer << NodeType::ParticleServer
|
<< NodeType::AvatarMixer << NodeType::VoxelServer << NodeType::ParticleServer
|
||||||
<< NodeType::MetavoxelServer;
|
<< NodeType::MetavoxelServer;
|
||||||
|
|
||||||
|
|
||||||
void DomainServer::addNodeToNodeListAndConfirmConnection(const QByteArray& packet, const HifiSockAddr& senderSockAddr) {
|
void DomainServer::addNodeToNodeListAndConfirmConnection(const QByteArray& packet, const HifiSockAddr& senderSockAddr) {
|
||||||
|
|
||||||
NodeType_t nodeType;
|
NodeType_t nodeType;
|
||||||
|
@ -353,34 +352,40 @@ void DomainServer::addNodeToNodeListAndConfirmConnection(const QByteArray& packe
|
||||||
int numPreInterestBytes = parseNodeDataFromByteArray(nodeType, publicSockAddr, localSockAddr, packet, senderSockAddr);
|
int numPreInterestBytes = parseNodeDataFromByteArray(nodeType, publicSockAddr, localSockAddr, packet, senderSockAddr);
|
||||||
|
|
||||||
QUuid assignmentUUID = uuidFromPacketHeader(packet);
|
QUuid assignmentUUID = uuidFromPacketHeader(packet);
|
||||||
SharedAssignmentPointer matchingAssignment;
|
bool isStaticAssignment = _staticAssignmentHash.contains(assignmentUUID);
|
||||||
|
SharedAssignmentPointer matchingAssignment = SharedAssignmentPointer();
|
||||||
|
|
||||||
if (!assignmentUUID.isNull() && (matchingAssignment = matchingStaticAssignmentForCheckIn(assignmentUUID, nodeType))
|
if (isStaticAssignment) {
|
||||||
&& matchingAssignment) {
|
// this is a static assignment, make sure the UUID sent is for an assignment we're actually trying to give out
|
||||||
// this is an assigned node, make sure the UUID sent is for an assignment we're actually trying to give out
|
matchingAssignment = matchingQueuedAssignmentForCheckIn(assignmentUUID, nodeType);
|
||||||
|
|
||||||
// remove the matching assignment from the assignment queue so we don't take the next check in
|
if (matchingAssignment) {
|
||||||
// (if it exists)
|
// remove the matching assignment from the assignment queue so we don't take the next check in
|
||||||
removeMatchingAssignmentFromQueue(matchingAssignment);
|
// (if it exists)
|
||||||
|
removeMatchingAssignmentFromQueue(matchingAssignment);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
assignmentUUID = QUuid();
|
assignmentUUID = QUuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a new session UUID for this node
|
// make sure this was either not a static assignment or it was and we had a matching one in teh queue
|
||||||
QUuid nodeUUID = QUuid::createUuid();
|
if ((!isStaticAssignment && !STATICALLY_ASSIGNED_NODES.contains(nodeType)) || (isStaticAssignment && matchingAssignment)) {
|
||||||
|
// create a new session UUID for this node
|
||||||
SharedNodePointer newNode = LimitedNodeList::getInstance()->addOrUpdateNode(nodeUUID, nodeType,
|
QUuid nodeUUID = QUuid::createUuid();
|
||||||
publicSockAddr, localSockAddr);
|
|
||||||
|
SharedNodePointer newNode = LimitedNodeList::getInstance()->addOrUpdateNode(nodeUUID, nodeType,
|
||||||
// when the newNode is created the linked data is also created
|
publicSockAddr, localSockAddr);
|
||||||
// if this was a static assignment set the UUID, set the sendingSockAddr
|
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(newNode->getLinkedData());
|
// when the newNode is created the linked data is also created
|
||||||
|
// if this was a static assignment set the UUID, set the sendingSockAddr
|
||||||
nodeData->setStaticAssignmentUUID(assignmentUUID);
|
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(newNode->getLinkedData());
|
||||||
nodeData->setSendingSockAddr(senderSockAddr);
|
|
||||||
|
nodeData->setStaticAssignmentUUID(assignmentUUID);
|
||||||
// reply back to the user with a PacketTypeDomainList
|
nodeData->setSendingSockAddr(senderSockAddr);
|
||||||
sendDomainListToNode(newNode, senderSockAddr, nodeInterestListFromPacket(packet, numPreInterestBytes));
|
|
||||||
|
// reply back to the user with a PacketTypeDomainList
|
||||||
|
sendDomainListToNode(newNode, senderSockAddr, nodeInterestListFromPacket(packet, numPreInterestBytes));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DomainServer::parseNodeDataFromByteArray(NodeType_t& nodeType, HifiSockAddr& publicSockAddr,
|
int DomainServer::parseNodeDataFromByteArray(NodeType_t& nodeType, HifiSockAddr& publicSockAddr,
|
||||||
|
@ -1004,7 +1009,7 @@ void DomainServer::nodeKilled(SharedNodePointer node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedAssignmentPointer DomainServer::matchingStaticAssignmentForCheckIn(const QUuid& checkInUUID, NodeType_t nodeType) {
|
SharedAssignmentPointer DomainServer::matchingQueuedAssignmentForCheckIn(const QUuid& checkInUUID, NodeType_t nodeType) {
|
||||||
QQueue<SharedAssignmentPointer>::iterator i = _assignmentQueue.begin();
|
QQueue<SharedAssignmentPointer>::iterator i = _assignmentQueue.begin();
|
||||||
|
|
||||||
while (i != _assignmentQueue.end()) {
|
while (i != _assignmentQueue.end()) {
|
||||||
|
|
|
@ -70,7 +70,7 @@ private:
|
||||||
void createStaticAssignmentsForType(Assignment::Type type, const QJsonArray& configArray);
|
void createStaticAssignmentsForType(Assignment::Type type, const QJsonArray& configArray);
|
||||||
void populateDefaultStaticAssignmentsExcludingTypes(const QSet<Assignment::Type>& excludedTypes);
|
void populateDefaultStaticAssignmentsExcludingTypes(const QSet<Assignment::Type>& excludedTypes);
|
||||||
|
|
||||||
SharedAssignmentPointer matchingStaticAssignmentForCheckIn(const QUuid& checkInUUID, NodeType_t nodeType);
|
SharedAssignmentPointer matchingQueuedAssignmentForCheckIn(const QUuid& checkInUUID, NodeType_t nodeType);
|
||||||
SharedAssignmentPointer deployableAssignmentForRequest(const Assignment& requestAssignment);
|
SharedAssignmentPointer deployableAssignmentForRequest(const Assignment& requestAssignment);
|
||||||
void removeMatchingAssignmentFromQueue(const SharedAssignmentPointer& removableAssignment);
|
void removeMatchingAssignmentFromQueue(const SharedAssignmentPointer& removableAssignment);
|
||||||
void refreshStaticAssignmentAndAddToQueue(SharedAssignmentPointer& assignment);
|
void refreshStaticAssignmentAndAddToQueue(SharedAssignmentPointer& assignment);
|
||||||
|
|
Loading…
Reference in a new issue