mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 20:24:13 +02:00
distinguish between eachNode and eachNodeBreakable
This commit is contained in:
parent
270823be43
commit
e92376cf64
7 changed files with 10 additions and 27 deletions
|
@ -862,8 +862,6 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif
|
||||||
// append the nodeByteArray to the current state of broadcastDataStream
|
// append the nodeByteArray to the current state of broadcastDataStream
|
||||||
broadcastPacket.append(nodeByteArray);
|
broadcastPacket.append(nodeByteArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -995,8 +993,6 @@ void DomainServer::setupPendingAssignmentCredits() {
|
||||||
_pendingAssignmentCredits.insert(nodeData->getWalletUUID(), freshTransaction);
|
_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()) {
|
if (node->getLinkedData() && !static_cast<DomainServerNodeData*>(node->getLinkedData())->getUsername().isEmpty()) {
|
||||||
++numConnectedAuthedUsers;
|
++numConnectedAuthedUsers;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const QString DOMAIN_HEARTBEAT_KEY = "heartbeat";
|
const QString DOMAIN_HEARTBEAT_KEY = "heartbeat";
|
||||||
|
@ -1440,8 +1434,6 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
||||||
QString uuidString = uuidStringWithoutCurlyBraces(nodeData->getAssignmentUUID());
|
QString uuidString = uuidStringWithoutCurlyBraces(nodeData->getAssignmentUUID());
|
||||||
assignedNodesJSON[uuidString] = jsonObjectForNode(node);
|
assignedNodesJSON[uuidString] = jsonObjectForNode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
assignmentJSON["fulfilled"] = assignedNodesJSON;
|
assignmentJSON["fulfilled"] = assignedNodesJSON;
|
||||||
|
@ -1499,8 +1491,6 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
||||||
LimitedNodeList::getInstance()->eachNode([this, &nodesJSONArray](const SharedNodePointer& node){
|
LimitedNodeList::getInstance()->eachNode([this, &nodesJSONArray](const SharedNodePointer& node){
|
||||||
// add the node using the UUID as the key
|
// add the node using the UUID as the key
|
||||||
nodesJSONArray.append(jsonObjectForNode(node));
|
nodesJSONArray.append(jsonObjectForNode(node));
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
rootJSON["nodes"] = nodesJSONArray;
|
rootJSON["nodes"] = nodesJSONArray;
|
||||||
|
|
|
@ -422,8 +422,6 @@ unsigned LimitedNodeList::broadcastToNodes(const QByteArray& packet, const NodeS
|
||||||
writeDatagram(packet, node);
|
writeDatagram(packet, node);
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
|
|
|
@ -131,6 +131,15 @@ public:
|
||||||
void eachNode(NodeLambda functor) {
|
void eachNode(NodeLambda functor) {
|
||||||
QReadLocker readLock(&_nodeMutex);
|
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) {
|
for (NodeHash::const_iterator it = _nodeHash.cbegin(); it != _nodeHash.cend(); ++it) {
|
||||||
if (!functor(it->second)) {
|
if (!functor(it->second)) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -454,8 +454,6 @@ void NodeList::pingInactiveNodes() {
|
||||||
// we don't have an active link to this node, ping it to set that up
|
// we don't have an active link to this node, ping it to set that up
|
||||||
pingPunchForInactiveNode(node);
|
pingPunchForInactiveNode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,6 @@ bool JurisdictionListener::queueJurisdictionRequest() {
|
||||||
_packetSender.queuePacketForSending(node, QByteArray(reinterpret_cast<char*>(bufferOut), sizeOut));
|
_packetSender.queuePacketForSending(node, QByteArray(reinterpret_cast<char*>(bufferOut), sizeOut));
|
||||||
nodeCount++;
|
nodeCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (nodeCount > 0){
|
if (nodeCount > 0){
|
||||||
|
|
|
@ -52,7 +52,7 @@ bool OctreeEditPacketSender::serversExist() const {
|
||||||
bool hasServers = false;
|
bool hasServers = false;
|
||||||
bool atLeastOneJurisdictionMissing = false; // assume the best
|
bool atLeastOneJurisdictionMissing = false; // assume the best
|
||||||
|
|
||||||
NodeList::getInstance()->eachNode([&](const SharedNodePointer& node){
|
NodeList::getInstance()->eachNodeBreakable([&](const SharedNodePointer& node){
|
||||||
if (node->getType() == getMyNodeType() && node->getActiveSocket()) {
|
if (node->getType() == getMyNodeType() && node->getActiveSocket()) {
|
||||||
|
|
||||||
QUuid nodeUUID = node->getUUID();
|
QUuid nodeUUID = node->getUUID();
|
||||||
|
@ -126,8 +126,6 @@ void OctreeEditPacketSender::queuePacketToNode(const QUuid& nodeUUID, unsigned c
|
||||||
" transitTimeSoFar=" << transitTime << " usecs";
|
" transitTimeSoFar=" << transitTime << " usecs";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,8 +207,6 @@ void OctreeEditPacketSender::queuePacketToNodes(unsigned char* buffer, size_t le
|
||||||
queuePacketToNode(nodeUUID, buffer, length, satoshiCost);
|
queuePacketToNode(nodeUUID, buffer, length, satoshiCost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,8 +295,6 @@ void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned ch
|
||||||
packetBuffer._satoshiCost += satoshiCost;
|
packetBuffer._satoshiCost += satoshiCost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
_packetsQueueLock.unlock();
|
_packetsQueueLock.unlock();
|
||||||
|
|
|
@ -113,8 +113,6 @@ void OctreeHeadlessViewer::queryOctree() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (wantExtraDebugging) {
|
if (wantExtraDebugging) {
|
||||||
|
@ -234,8 +232,6 @@ void OctreeHeadlessViewer::queryOctree() {
|
||||||
// make sure we still have an active socket
|
// make sure we still have an active socket
|
||||||
nodeList->writeUnverifiedDatagram(reinterpret_cast<const char*>(queryPacket), packetLength, node);
|
nodeList->writeUnverifiedDatagram(reinterpret_cast<const char*>(queryPacket), packetLength, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue