History

leverage new libcuckoo hash outside LimitedNodeList

Stephen Birarda committed 12 years ago

Commit 8a72cdd1 parent a492abc16 files · +157 −64Browse files

Showing the changes to interface/src/Application.cpp (1 of 16 files). Show all

Unified · Split

interface/src/Application.cpp+14−6
@@ -2405,7 +2405,10 @@ int Application::sendNackPackets() { · 2404 unmodified lines
24052405 char packet[MAX_PACKET_SIZE];
24062406
24072407 // iterates thru all nodes in NodeList
2408− foreach(const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
2408+ NodeHashSnapshot snapshotHash = NodeList::getInstance()->getNodeHash().snapshot_table();
2409+
2410+ for (auto it = snapshotHash.begin(); it != snapshotHash.end(); it++) {
2411+ SharedNodePointer node = it->second;
24092412
24102413 if (node->getActiveSocket() &&
24112414 ( node->getType() == NodeType::VoxelServer
@@ -2503,7 +2506,13 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 91 unmodified lines
25032506 int inViewServers = 0;
25042507 int unknownJurisdictionServers = 0;
25052508
2506− foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
2509+ NodeList* nodeList = NodeList::getInstance();
2510+ NodeHashSnapshot snapshotHash = nodeList->getNodeHash().snapshot_table();
2511+
2512+ for (auto it = snapshotHash.begin(); it != snapshotHash.end(); it++) {
2513+
2514+ SharedNodePointer node = it->second;
2515+
25072516 // only send to the NodeTypes that are serverType
25082517 if (node->getActiveSocket() && node->getType() == serverType) {
25092518 totalServers++;
@@ -2560,10 +2569,9 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 50 unmodified lines
25602569 if (wantExtraDebugging) {
25612570 qDebug("perServerPPS: %d perUnknownServer: %d", perServerPPS, perUnknownServer);
25622571 }
2563−
2564− NodeList* nodeList = NodeList::getInstance();
2565−
2566− foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
2572+
2573+ for (auto it = snapshotHash.begin(); it != snapshotHash.end(); it++) {
2574+ SharedNodePointer node = it->second;
25672575 // only send to the NodeTypes that are serverType
25682576 if (node->getActiveSocket() && node->getType() == serverType) {
25692577

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t