mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 06:17:28 +02:00
Merge pull request #10669 from huffman/feat/replicants-upstream
node isUpstream
This commit is contained in:
commit
22ad6beff6
8 changed files with 31 additions and 7 deletions
|
@ -122,6 +122,7 @@ void AudioMixer::queueReplicatedAudioPacket(QSharedPointer<ReceivedMessage> mess
|
||||||
|
|
||||||
auto node = nodeList->addOrUpdateNode(nodeID, NodeType::Agent,
|
auto node = nodeList->addOrUpdateNode(nodeID, NodeType::Agent,
|
||||||
message->getSenderSockAddr(), message->getSenderSockAddr());
|
message->getSenderSockAddr(), message->getSenderSockAddr());
|
||||||
|
node->setIsUpstream(true);
|
||||||
node->setIsMirror(true);
|
node->setIsMirror(true);
|
||||||
node->setLastHeardMicrostamp(usecTimestampNow());
|
node->setLastHeardMicrostamp(usecTimestampNow());
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,10 @@ void AudioMixerSlave::mix(const SharedNodePointer& node) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node->isUpstream()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// check that the stream is valid
|
// check that the stream is valid
|
||||||
auto avatarStream = data->getAvatarAudioStream();
|
auto avatarStream = data->getAvatarAudioStream();
|
||||||
if (avatarStream == nullptr) {
|
if (avatarStream == nullptr) {
|
||||||
|
|
|
@ -2211,6 +2211,11 @@ void DomainServer::refreshStaticAssignmentAndAddToQueue(SharedAssignmentPointer&
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainServer::nodeAdded(SharedNodePointer node) {
|
void DomainServer::nodeAdded(SharedNodePointer node) {
|
||||||
|
// TODO Check to see if node is in list of replicated nodes
|
||||||
|
if (node->getType() == NodeType::Agent) {
|
||||||
|
node->setIsReplicated(true);
|
||||||
|
}
|
||||||
|
|
||||||
// we don't use updateNodeWithData, so add the DomainServerNodeData to the node here
|
// we don't use updateNodeWithData, so add the DomainServerNodeData to the node here
|
||||||
node->setLinkedData(std::unique_ptr<DomainServerNodeData> { new DomainServerNodeData() });
|
node->setLinkedData(std::unique_ptr<DomainServerNodeData> { new DomainServerNodeData() });
|
||||||
}
|
}
|
||||||
|
|
|
@ -569,6 +569,7 @@ void LimitedNodeList::handleNodeKill(const SharedNodePointer& node) {
|
||||||
SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType,
|
SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType,
|
||||||
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
||||||
const NodePermissions& permissions,
|
const NodePermissions& permissions,
|
||||||
|
bool isReplicated,
|
||||||
const QUuid& connectionSecret) {
|
const QUuid& connectionSecret) {
|
||||||
QReadLocker readLocker(&_nodeMutex);
|
QReadLocker readLocker(&_nodeMutex);
|
||||||
NodeHash::const_iterator it = _nodeHash.find(uuid);
|
NodeHash::const_iterator it = _nodeHash.find(uuid);
|
||||||
|
@ -580,11 +581,12 @@ SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t
|
||||||
matchingNode->setLocalSocket(localSocket);
|
matchingNode->setLocalSocket(localSocket);
|
||||||
matchingNode->setPermissions(permissions);
|
matchingNode->setPermissions(permissions);
|
||||||
matchingNode->setConnectionSecret(connectionSecret);
|
matchingNode->setConnectionSecret(connectionSecret);
|
||||||
|
matchingNode->setIsReplicated(isReplicated);
|
||||||
|
|
||||||
return matchingNode;
|
return matchingNode;
|
||||||
} else {
|
} else {
|
||||||
// we didn't have this node, so add them
|
// we didn't have this node, so add them
|
||||||
Node* newNode = new Node(uuid, nodeType, publicSocket, localSocket, permissions, connectionSecret);
|
Node* newNode = new Node(uuid, nodeType, publicSocket, localSocket, permissions, isReplicated, connectionSecret);
|
||||||
|
|
||||||
if (nodeType == NodeType::AudioMixer) {
|
if (nodeType == NodeType::AudioMixer) {
|
||||||
LimitedNodeList::flagTimeForConnectionStep(LimitedNodeList::AddedAudioMixer);
|
LimitedNodeList::flagTimeForConnectionStep(LimitedNodeList::AddedAudioMixer);
|
||||||
|
|
|
@ -146,7 +146,7 @@ public:
|
||||||
SharedNodePointer addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType,
|
SharedNodePointer addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType,
|
||||||
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
||||||
const NodePermissions& permissions = DEFAULT_AGENT_PERMISSIONS,
|
const NodePermissions& permissions = DEFAULT_AGENT_PERMISSIONS,
|
||||||
const QUuid& connectionSecret = QUuid());
|
bool isReplicated = false, const QUuid& connectionSecret = QUuid());
|
||||||
|
|
||||||
static bool parseSTUNResponse(udt::BasePacket* packet, QHostAddress& newPublicAddress, uint16_t& newPublicPort);
|
static bool parseSTUNResponse(udt::BasePacket* packet, QHostAddress& newPublicAddress, uint16_t& newPublicPort);
|
||||||
bool hasCompletedInitialSTUN() const { return _hasCompletedInitialSTUN; }
|
bool hasCompletedInitialSTUN() const { return _hasCompletedInitialSTUN; }
|
||||||
|
|
|
@ -51,11 +51,12 @@ const QString& NodeType::getNodeTypeName(NodeType_t nodeType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket,
|
Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket,
|
||||||
const HifiSockAddr& localSocket, const NodePermissions& permissions, const QUuid& connectionSecret,
|
const HifiSockAddr& localSocket, const NodePermissions& permissions, bool isReplicated,
|
||||||
QObject* parent) :
|
const QUuid& connectionSecret, QObject* parent) :
|
||||||
NetworkPeer(uuid, publicSocket, localSocket, parent),
|
NetworkPeer(uuid, publicSocket, localSocket, parent),
|
||||||
_type(type),
|
_type(type),
|
||||||
_connectionSecret(connectionSecret),
|
_connectionSecret(connectionSecret),
|
||||||
|
_isReplicated(isReplicated),
|
||||||
_pingMs(-1), // "Uninitialized"
|
_pingMs(-1), // "Uninitialized"
|
||||||
_clockSkewUsec(0),
|
_clockSkewUsec(0),
|
||||||
_mutex(),
|
_mutex(),
|
||||||
|
@ -135,6 +136,7 @@ QDataStream& operator<<(QDataStream& out, const Node& node) {
|
||||||
out << node._publicSocket;
|
out << node._publicSocket;
|
||||||
out << node._localSocket;
|
out << node._localSocket;
|
||||||
out << node._permissions;
|
out << node._permissions;
|
||||||
|
out << node._isReplicated;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,6 +146,7 @@ QDataStream& operator>>(QDataStream& in, Node& node) {
|
||||||
in >> node._publicSocket;
|
in >> node._publicSocket;
|
||||||
in >> node._localSocket;
|
in >> node._localSocket;
|
||||||
in >> node._permissions;
|
in >> node._permissions;
|
||||||
|
in >> node._isReplicated;
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Node : public NetworkPeer {
|
||||||
public:
|
public:
|
||||||
Node(const QUuid& uuid, NodeType_t type,
|
Node(const QUuid& uuid, NodeType_t type,
|
||||||
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
||||||
const NodePermissions& permissions, const QUuid& connectionSecret = QUuid(),
|
const NodePermissions& permissions, bool isReplicated, const QUuid& connectionSecret = QUuid(),
|
||||||
QObject* parent = nullptr);
|
QObject* parent = nullptr);
|
||||||
|
|
||||||
bool operator==(const Node& otherNode) const { return _uuid == otherNode._uuid; }
|
bool operator==(const Node& otherNode) const { return _uuid == otherNode._uuid; }
|
||||||
|
@ -48,6 +48,12 @@ public:
|
||||||
char getType() const { return _type; }
|
char getType() const { return _type; }
|
||||||
void setType(char type);
|
void setType(char type);
|
||||||
|
|
||||||
|
bool isReplicated() const { return _isReplicated; }
|
||||||
|
void setIsReplicated(bool isReplicated) { _isReplicated = isReplicated; }
|
||||||
|
|
||||||
|
bool isUpstream() const { return _isUpstream; }
|
||||||
|
void setIsUpstream(bool isUpstream) { _isUpstream = isUpstream; }
|
||||||
|
|
||||||
const QUuid& getConnectionSecret() const { return _connectionSecret; }
|
const QUuid& getConnectionSecret() const { return _connectionSecret; }
|
||||||
void setConnectionSecret(const QUuid& connectionSecret) { _connectionSecret = connectionSecret; }
|
void setConnectionSecret(const QUuid& connectionSecret) { _connectionSecret = connectionSecret; }
|
||||||
|
|
||||||
|
@ -92,11 +98,13 @@ private:
|
||||||
|
|
||||||
QUuid _connectionSecret;
|
QUuid _connectionSecret;
|
||||||
std::unique_ptr<NodeData> _linkedData;
|
std::unique_ptr<NodeData> _linkedData;
|
||||||
|
bool _isReplicated { false };
|
||||||
int _pingMs;
|
int _pingMs;
|
||||||
qint64 _clockSkewUsec;
|
qint64 _clockSkewUsec;
|
||||||
QMutex _mutex;
|
QMutex _mutex;
|
||||||
MovingPercentile _clockSkewMovingPercentile;
|
MovingPercentile _clockSkewMovingPercentile;
|
||||||
NodePermissions _permissions;
|
NodePermissions _permissions;
|
||||||
|
bool _isUpstream { false };
|
||||||
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _ignoredNodeIDSet;
|
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _ignoredNodeIDSet;
|
||||||
mutable QReadWriteLock _ignoredNodeIDSetLock;
|
mutable QReadWriteLock _ignoredNodeIDSetLock;
|
||||||
|
|
||||||
|
|
|
@ -654,8 +654,9 @@ void NodeList::parseNodeFromPacketStream(QDataStream& packetStream) {
|
||||||
QUuid nodeUUID, connectionUUID;
|
QUuid nodeUUID, connectionUUID;
|
||||||
HifiSockAddr nodePublicSocket, nodeLocalSocket;
|
HifiSockAddr nodePublicSocket, nodeLocalSocket;
|
||||||
NodePermissions permissions;
|
NodePermissions permissions;
|
||||||
|
bool isReplicated;
|
||||||
|
|
||||||
packetStream >> nodeType >> nodeUUID >> nodePublicSocket >> nodeLocalSocket >> permissions;
|
packetStream >> nodeType >> nodeUUID >> nodePublicSocket >> nodeLocalSocket >> permissions >> isReplicated;
|
||||||
|
|
||||||
// if the public socket address is 0 then it's reachable at the same IP
|
// if the public socket address is 0 then it's reachable at the same IP
|
||||||
// as the domain server
|
// as the domain server
|
||||||
|
@ -666,7 +667,7 @@ void NodeList::parseNodeFromPacketStream(QDataStream& packetStream) {
|
||||||
packetStream >> connectionUUID;
|
packetStream >> connectionUUID;
|
||||||
|
|
||||||
SharedNodePointer node = addOrUpdateNode(nodeUUID, nodeType, nodePublicSocket,
|
SharedNodePointer node = addOrUpdateNode(nodeUUID, nodeType, nodePublicSocket,
|
||||||
nodeLocalSocket, permissions, connectionUUID);
|
nodeLocalSocket, permissions, isReplicated, connectionUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeList::sendAssignment(Assignment& assignment) {
|
void NodeList::sendAssignment(Assignment& assignment) {
|
||||||
|
|
Loading…
Reference in a new issue