migrate EntityServer and OctreeServer to tbb concurrent map

This commit is contained in:
Stephen Birarda 2014-11-06 13:54:40 -08:00
parent 1a953b5906
commit 881d03b11d
2 changed files with 7 additions and 11 deletions

View file

@ -124,11 +124,7 @@ void EntityServer::pruneDeletedEntities() {
quint64 earliestLastDeletedEntitiesSent = usecTimestampNow() + 1; // in the future
NodeHashSnapshot snapshotHash = NodeList::getInstance()->getNodeHash().snapshot_table();
for (auto it = snapshotHash.begin(); it != snapshotHash.end(); it++) {
SharedNodePointer node = it->second;
NodeList::getInstance()->eachNode([&earliestLastDeletedEntitiesSent](const SharedNodePointer& node) {
if (node->getLinkedData()) {
EntityNodeData* nodeData = static_cast<EntityNodeData*>(node->getLinkedData());
quint64 nodeLastDeletedEntitiesSentAt = nodeData->getLastDeletedEntitiesSentAt();
@ -136,7 +132,8 @@ void EntityServer::pruneDeletedEntities() {
earliestLastDeletedEntitiesSent = nodeLastDeletedEntitiesSentAt;
}
}
}
});
tree->forgetEntitiesDeletedBefore(earliestLastDeletedEntitiesSent);
}
}

View file

@ -1138,12 +1138,11 @@ void OctreeServer::aboutToFinish() {
qDebug() << qPrintable(_safeServerName) << "inform Octree Inbound Packet Processor that we are shutting down...";
_octreeInboundPacketProcessor->shuttingDown();
NodeHashSnapshot snapshotHash = NodeList::getInstance()->getNodeHash().snapshot_table();
NodeList::getInstance()->eachNode([this](const SharedNodePointer& node) {
qDebug() << qPrintable(_safeServerName) << "server about to finish while node still connected node:" << *node;
forceNodeShutdown(node);
});
for (auto it = snapshotHash.begin(); it != snapshotHash.end(); it++) {
qDebug() << qPrintable(_safeServerName) << "server about to finish while node still connected node:" << *it->second;
forceNodeShutdown(it->second);
}
qDebug() << qPrintable(_safeServerName) << "server ENDING about to finish...";
}