mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 08:48:43 +02:00
keep downstream nodes around in domain, alive in upstream
This commit is contained in:
parent
1ed0b693da
commit
224a559602
4 changed files with 12 additions and 1 deletions
|
@ -2267,6 +2267,7 @@ void DomainServer::updateDownstreamNodes() {
|
|||
// manually add the downstream node to our node list
|
||||
auto node = nodeList->addOrUpdateNode(QUuid::createUuid(), downstreamNodeType,
|
||||
downstreamServerAddr, downstreamServerAddr);
|
||||
node->setIsForcedAlive(true);
|
||||
|
||||
qDebug() << "Adding downstream node:" << node->getUUID() << downstreamServerAddr;
|
||||
|
||||
|
|
|
@ -749,7 +749,7 @@ void LimitedNodeList::removeSilentNodes() {
|
|||
SharedNodePointer node = it->second;
|
||||
node->getMutex().lock();
|
||||
|
||||
if (!NodeType::isDownstream(node->getType())
|
||||
if (!node->isForcedAlive()
|
||||
&& (usecTimestampNow() - node->getLastHeardMicrostamp()) > (NODE_SILENCE_THRESHOLD_MSECS * USECS_PER_MSEC)) {
|
||||
// call the NodeHash erase to get rid of this node
|
||||
it = _nodeHash.unsafe_erase(it);
|
||||
|
|
|
@ -76,6 +76,9 @@ public:
|
|||
float getOutboundBandwidth() const; // in kbps
|
||||
float getInboundBandwidth() const; // in kbps
|
||||
|
||||
bool isForcedAlive() const { return _isForcedAlive; }
|
||||
void setIsForcedAlive(bool isForcedAlive) { _isForcedAlive = isForcedAlive; }
|
||||
|
||||
friend QDataStream& operator<<(QDataStream& out, const NetworkPeer& peer);
|
||||
friend QDataStream& operator>>(QDataStream& in, NetworkPeer& peer);
|
||||
public slots:
|
||||
|
@ -103,6 +106,8 @@ protected:
|
|||
QTimer* _pingTimer = NULL;
|
||||
|
||||
int _connectionAttempts;
|
||||
|
||||
bool _isForcedAlive { false };
|
||||
};
|
||||
|
||||
QDebug operator<<(QDebug debug, const NetworkPeer &peer);
|
||||
|
|
|
@ -668,6 +668,11 @@ void NodeList::parseNodeFromPacketStream(QDataStream& packetStream) {
|
|||
|
||||
SharedNodePointer node = addOrUpdateNode(nodeUUID, nodeType, nodePublicSocket,
|
||||
nodeLocalSocket, permissions, isReplicated, connectionUUID);
|
||||
|
||||
// nodes that are downstream of our own type are kept alive when we hear about them from the domain server
|
||||
if (node->getType() == NodeType::downstreamType(_ownerType)) {
|
||||
node->setLastHeardMicrostamp(usecTimestampNow());
|
||||
}
|
||||
}
|
||||
|
||||
void NodeList::sendAssignment(Assignment& assignment) {
|
||||
|
|
Loading…
Reference in a new issue