mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-16 22:30:42 +02:00
add isDownstream for cleaner conditionals
This commit is contained in:
parent
03a8d7b8c8
commit
4042e04946
4 changed files with 7 additions and 2 deletions
|
@ -744,7 +744,7 @@ void LimitedNodeList::removeSilentNodes() {
|
|||
SharedNodePointer node = it->second;
|
||||
node->getMutex().lock();
|
||||
|
||||
if (node->getType() != NodeType::DownstreamAudioMixer && node->getType() != NodeType::DownstreamAvatarMixer
|
||||
if (!NodeType::isDownstream(node->getType())
|
||||
&& (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);
|
||||
|
|
|
@ -52,6 +52,10 @@ const QString& NodeType::getNodeTypeName(NodeType_t nodeType) {
|
|||
return matchedTypeName != TypeNameHash.end() ? matchedTypeName.value() : UNKNOWN_NodeType_t_NAME;
|
||||
}
|
||||
|
||||
bool NodeType::isDownstream(NodeType_t nodeType) {
|
||||
return nodeType == NodeType::DownstreamAudioMixer || nodeType == NodeType::DownstreamAvatarMixer;
|
||||
}
|
||||
|
||||
Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket,
|
||||
const HifiSockAddr& localSocket, const NodePermissions& permissions, bool isReplicated,
|
||||
const QUuid& connectionSecret, QObject* parent) :
|
||||
|
|
|
@ -714,7 +714,7 @@ void NodeList::pingPunchForInactiveNode(const SharedNodePointer& node) {
|
|||
void NodeList::startNodeHolePunch(const SharedNodePointer& node) {
|
||||
|
||||
// we don't hole punch to replicants, since it is assumed that we have a direct line to them
|
||||
if (node->getType() != NodeType::DownstreamAudioMixer && node->getType() != NodeType::DownstreamAvatarMixer) {
|
||||
if (!NodeType::isDownstream(node->getType())) {
|
||||
// connect to the correct signal on this node so we know when to ping it
|
||||
connect(node.data(), &Node::pingTimerTimeout, this, &NodeList::handleNodePingTimeout);
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace NodeType {
|
|||
|
||||
void init();
|
||||
const QString& getNodeTypeName(NodeType_t nodeType);
|
||||
bool isDownstream(NodeType_t nodeType);
|
||||
}
|
||||
|
||||
typedef QSet<NodeType_t> NodeSet;
|
||||
|
|
Loading…
Reference in a new issue