distinguish between eachNode and eachNodeBreakable

This commit is contained in:
Stephen Birarda 2014-11-06 13:41:55 -08:00
parent 270823be43
commit e92376cf64
7 changed files with 10 additions and 27 deletions

View file

@ -862,8 +862,6 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif
// append the nodeByteArray to the current state of broadcastDataStream
broadcastPacket.append(nodeByteArray);
}
return true;
});
}
@ -995,8 +993,6 @@ void DomainServer::setupPendingAssignmentCredits() {
_pendingAssignmentCredits.insert(nodeData->getWalletUUID(), freshTransaction);
}
}
return true;
});
}
@ -1127,8 +1123,6 @@ void DomainServer::sendHeartbeatToDataServer(const QString& networkAddress) {
if (node->getLinkedData() && !static_cast<DomainServerNodeData*>(node->getLinkedData())->getUsername().isEmpty()) {
++numConnectedAuthedUsers;
}
return true;
});
const QString DOMAIN_HEARTBEAT_KEY = "heartbeat";
@ -1440,8 +1434,6 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
QString uuidString = uuidStringWithoutCurlyBraces(nodeData->getAssignmentUUID());
assignedNodesJSON[uuidString] = jsonObjectForNode(node);
}
return true;
});
assignmentJSON["fulfilled"] = assignedNodesJSON;
@ -1499,8 +1491,6 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
LimitedNodeList::getInstance()->eachNode([this, &nodesJSONArray](const SharedNodePointer& node){
// add the node using the UUID as the key
nodesJSONArray.append(jsonObjectForNode(node));
return true;
});
rootJSON["nodes"] = nodesJSONArray;

View file

@ -422,8 +422,6 @@ unsigned LimitedNodeList::broadcastToNodes(const QByteArray& packet, const NodeS
writeDatagram(packet, node);
++n;
}
return true;
});
return n;

View file

@ -131,6 +131,15 @@ public:
void eachNode(NodeLambda functor) {
QReadLocker readLock(&_nodeMutex);
for (NodeHash::const_iterator it = _nodeHash.cbegin(); it != _nodeHash.cend(); ++it) {
functor(it->second);
}
}
template<typename BreakableNodeLambda>
void eachNodeBreakable(BreakableNodeLambda functor) {
QReadLocker readLock(&_nodeMutex);
for (NodeHash::const_iterator it = _nodeHash.cbegin(); it != _nodeHash.cend(); ++it) {
if (!functor(it->second)) {
break;

View file

@ -454,8 +454,6 @@ void NodeList::pingInactiveNodes() {
// we don't have an active link to this node, ping it to set that up
pingPunchForInactiveNode(node);
}
return true;
});
}

View file

@ -43,8 +43,6 @@ bool JurisdictionListener::queueJurisdictionRequest() {
_packetSender.queuePacketForSending(node, QByteArray(reinterpret_cast<char*>(bufferOut), sizeOut));
nodeCount++;
}
return true;
});
if (nodeCount > 0){

View file

@ -52,7 +52,7 @@ bool OctreeEditPacketSender::serversExist() const {
bool hasServers = false;
bool atLeastOneJurisdictionMissing = false; // assume the best
NodeList::getInstance()->eachNode([&](const SharedNodePointer& node){
NodeList::getInstance()->eachNodeBreakable([&](const SharedNodePointer& node){
if (node->getType() == getMyNodeType() && node->getActiveSocket()) {
QUuid nodeUUID = node->getUUID();
@ -126,8 +126,6 @@ void OctreeEditPacketSender::queuePacketToNode(const QUuid& nodeUUID, unsigned c
" transitTimeSoFar=" << transitTime << " usecs";
}
}
return true;
});
}
@ -209,8 +207,6 @@ void OctreeEditPacketSender::queuePacketToNodes(unsigned char* buffer, size_t le
queuePacketToNode(nodeUUID, buffer, length, satoshiCost);
}
}
return true;
});
}
@ -299,8 +295,6 @@ void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned ch
packetBuffer._satoshiCost += satoshiCost;
}
}
return true;
});
_packetsQueueLock.unlock();

View file

@ -113,8 +113,6 @@ void OctreeHeadlessViewer::queryOctree() {
}
}
}
return true;
});
if (wantExtraDebugging) {
@ -234,8 +232,6 @@ void OctreeHeadlessViewer::queryOctree() {
// make sure we still have an active socket
nodeList->writeUnverifiedDatagram(reinterpret_cast<const char*>(queryPacket), packetLength, node);
}
return true;
});
}