mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:41:20 +02:00
make sure UUID key changes in static assignment hash, closes #1770
This commit is contained in:
parent
8b934eed2e
commit
703b654728
1 changed files with 13 additions and 3 deletions
|
@ -534,13 +534,22 @@ void DomainServer::refreshStaticAssignmentAndAddToQueue(SharedAssignmentPointer&
|
||||||
assignment->resetUUID();
|
assignment->resetUUID();
|
||||||
|
|
||||||
qDebug() << "Reset UUID for assignment -" << *assignment.data() << "- and added to queue. Old UUID was"
|
qDebug() << "Reset UUID for assignment -" << *assignment.data() << "- and added to queue. Old UUID was"
|
||||||
<< uuidStringWithoutCurlyBraces( oldUUID);
|
<< uuidStringWithoutCurlyBraces(oldUUID);
|
||||||
|
|
||||||
|
// add the static assignment back under the right UUID, and to the queue
|
||||||
|
_staticAssignmentHash.insert(assignment->getUUID(), assignment);
|
||||||
|
|
||||||
_assignmentQueue.enqueue(assignment);
|
_assignmentQueue.enqueue(assignment);
|
||||||
|
|
||||||
|
// remove the old assignment from the _staticAssignmentHash
|
||||||
|
// this must be done last so copies are created before the assignment passed by reference is killed
|
||||||
|
_staticAssignmentHash.remove(oldUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainServer::nodeKilled(SharedNodePointer node) {
|
void DomainServer::nodeKilled(SharedNodePointer node) {
|
||||||
// if this node's UUID matches a static assignment we need to throw it back in the assignment queue
|
// if this node's UUID matches a static assignment we need to throw it back in the assignment queue
|
||||||
SharedAssignmentPointer matchedAssignment = _staticAssignmentHash.value(node->getUUID());
|
SharedAssignmentPointer matchedAssignment = _staticAssignmentHash.value(node->getUUID());
|
||||||
|
|
||||||
if (matchedAssignment) {
|
if (matchedAssignment) {
|
||||||
refreshStaticAssignmentAndAddToQueue(matchedAssignment);
|
refreshStaticAssignmentAndAddToQueue(matchedAssignment);
|
||||||
}
|
}
|
||||||
|
@ -633,8 +642,9 @@ void DomainServer::addStaticAssignmentsBackToQueueAfterRestart() {
|
||||||
|
|
||||||
// if the domain-server has just restarted,
|
// if the domain-server has just restarted,
|
||||||
// check if there are static assignments that we need to throw into the assignment queue
|
// check if there are static assignments that we need to throw into the assignment queue
|
||||||
QHash<QUuid, SharedAssignmentPointer>::iterator staticAssignment = _staticAssignmentHash.begin();
|
QHash<QUuid, SharedAssignmentPointer> staticHashCopy = _staticAssignmentHash;
|
||||||
while (staticAssignment != _staticAssignmentHash.end()) {
|
QHash<QUuid, SharedAssignmentPointer>::iterator staticAssignment = staticHashCopy.begin();
|
||||||
|
while (staticAssignment != staticHashCopy.end()) {
|
||||||
// add any of the un-matched static assignments to the queue
|
// add any of the un-matched static assignments to the queue
|
||||||
bool foundMatchingAssignment = false;
|
bool foundMatchingAssignment = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue