mirror of
https://github.com/overte-org/overte.git
synced 2025-04-11 05:22:11 +02:00
re-send ignore requests when mixers are re-added
This commit is contained in:
parent
a6f39d5e68
commit
b68958317a
6 changed files with 42 additions and 8 deletions
assignment-client/src
libraries/networking/src
|
@ -557,10 +557,7 @@ void AudioMixer::handleNodeKilled(SharedNodePointer killedNode) {
|
|||
}
|
||||
|
||||
void AudioMixer::handleNodeIgnoreRequestPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode) {
|
||||
// parse out the UUID being ignored from the packet
|
||||
QUuid ignoredUUID = QUuid::fromRfc4122(packet->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
||||
|
||||
sendingNode->addIgnoredNode(ignoredUUID);
|
||||
sendingNode->parseIgnoreRequestMessage(packet);
|
||||
}
|
||||
|
||||
void AudioMixer::removeHRTFsForFinishedInjector(const QUuid& streamID) {
|
||||
|
|
|
@ -434,10 +434,7 @@ void AvatarMixer::handleKillAvatarPacket(QSharedPointer<ReceivedMessage> message
|
|||
}
|
||||
|
||||
void AvatarMixer::handleNodeIgnoreRequestPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode) {
|
||||
// parse out the UUID being ignored from the packet
|
||||
QUuid ignoredUUID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
||||
|
||||
senderNode->addIgnoredNode(ignoredUUID);
|
||||
senderNode->parseIgnoreRequestMessage(message);
|
||||
}
|
||||
|
||||
void AvatarMixer::sendStatsPacket() {
|
||||
|
|
|
@ -80,6 +80,17 @@ void Node::updateClockSkewUsec(qint64 clockSkewSample) {
|
|||
_clockSkewUsec = (quint64)_clockSkewMovingPercentile.getValueAtPercentile();
|
||||
}
|
||||
|
||||
void Node::parseIgnoreRequestMessage(QSharedPointer<ReceivedMessage> message) {
|
||||
while (message->getBytesLeftToRead()) {
|
||||
// parse out the UUID being ignored from the packet
|
||||
QUuid ignoredUUID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
||||
|
||||
addIgnoredNode(ignoredUUID);
|
||||
|
||||
message->seek(message->getPosition() + NUM_BYTES_RFC4122_UUID);
|
||||
}
|
||||
}
|
||||
|
||||
void Node::addIgnoredNode(const QUuid& otherNodeID) {
|
||||
if (!otherNodeID.isNull() && otherNodeID != _uuid) {
|
||||
qCDebug(networking) << "Adding" << uuidStringWithoutCurlyBraces(otherNodeID) << "to ignore set for"
|
||||
|
|
|
@ -70,6 +70,7 @@ public:
|
|||
bool getCanRezTmp() const { return _permissions.canRezTemporaryEntities; }
|
||||
bool getCanWriteToAssetServer() const { return _permissions.canWriteToAssetServer; }
|
||||
|
||||
void parseIgnoreRequestMessage(QSharedPointer<ReceivedMessage> message);
|
||||
void addIgnoredNode(const QUuid& otherNodeID);
|
||||
bool isIgnoringNodeWithID(const QUuid& nodeID) const { return _ignoredNodeIDSet.find(nodeID) != _ignoredNodeIDSet.cend(); }
|
||||
|
||||
|
|
|
@ -93,6 +93,9 @@ NodeList::NodeList(char newOwnerType, unsigned short socketListenPort, unsigned
|
|||
|
||||
// anytime we get a new node we will want to attempt to punch to it
|
||||
connect(this, &LimitedNodeList::nodeAdded, this, &NodeList::startNodeHolePunch);
|
||||
|
||||
// anytime we get a new node we may need to re-send our set of ignored node IDs to it
|
||||
connect(this, &LimitedNodeList::nodeAdded, this, &NodeList::maybeSendIgnoreSetToNode);
|
||||
|
||||
// setup our timer to send keepalive pings (it's started and stopped on domain connect/disconnect)
|
||||
_keepAlivePingTimer.setInterval(KEEPALIVE_PING_INTERVAL_MS);
|
||||
|
@ -737,3 +740,26 @@ bool NodeList::isIgnoringNode(const QUuid& nodeID) const {
|
|||
QReadLocker setLocker { &_ignoredSetLock };
|
||||
return _ignoredNodeIDs.find(nodeID) != _ignoredNodeIDs.cend();
|
||||
}
|
||||
|
||||
void NodeList::maybeSendIgnoreSetToNode(SharedNodePointer newNode) {
|
||||
if (newNode->getType() == NodeType::AudioMixer || newNode->getType() == NodeType::AvatarMixer) {
|
||||
// this is a mixer that we just added - it's unlikely it knows who we were previously ignoring in this session,
|
||||
// so send that list along now (assuming it isn't empty)
|
||||
|
||||
QReadLocker setLocker { &_ignoredSetLock };
|
||||
if (_ignoredNodeIDs.size() > 0) {
|
||||
// setup a packet list so we can send the stream of ignore IDs
|
||||
auto ignorePacketList = NLPacketList::create(PacketType::NodeIgnoreRequest, QByteArray(), true);
|
||||
|
||||
// enumerate the ignored IDs and write them to the packet list
|
||||
auto it = _ignoredNodeIDs.cbegin();
|
||||
while (it != _ignoredNodeIDs.end()) {
|
||||
ignorePacketList->write(it->toRfc4122());
|
||||
++it;
|
||||
}
|
||||
|
||||
// send this NLPacketList to the new node
|
||||
sendPacketList(std::move(ignorePacketList), *newNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,6 +110,8 @@ private slots:
|
|||
void pingPunchForDomainServer();
|
||||
|
||||
void sendKeepAlivePings();
|
||||
|
||||
void maybeSendIgnoreSetToNode(SharedNodePointer node);
|
||||
|
||||
private:
|
||||
NodeList() : LimitedNodeList(0, 0) { assert(false); } // Not implemented, needed for DependencyManager templates compile
|
||||
|
|
Loading…
Reference in a new issue