Add node data to downstream avatar mixers

This commit is contained in:
Ryan Huffman 2017-06-13 15:29:25 -07:00 committed by Stephen Birarda
parent 6c5947d319
commit 52150ad971
3 changed files with 13 additions and 5 deletions
assignment-client/src/avatars
libraries/networking/src

View file

@ -851,5 +851,9 @@ void AvatarMixer::parseDomainServerSettings(const QJsonObject& domainSettings) {
<< "and a maximum avatar scale of" << _domainMaximumScale;
parseDownstreamServers(domainSettings, NodeType::AvatarMixer);
parseDownstreamServers(domainSettings, NodeType::AvatarMixer, [](Node& node) {
if (!node.getLinkedData()) {
node.setLinkedData(std::unique_ptr<NodeData> { new AvatarMixerClientData(node.getUUID()) });
}
});
}

View file

@ -134,7 +134,7 @@ void ThreadedAssignment::domainSettingsRequestFailed() {
setFinished(true);
}
void ThreadedAssignment::parseDownstreamServers(const QJsonObject& settingsObject, NodeType_t nodeType) {
void ThreadedAssignment::parseDownstreamServers(const QJsonObject& settingsObject, NodeType_t nodeType, DownstreamNodeFoundCallback callback) {
static const QString REPLICATION_GROUP_KEY = "replication";
static const QString DOWNSTREAM_SERVERS_SETTING_KEY = "downstream_servers";
if (settingsObject.contains(REPLICATION_GROUP_KEY)) {
@ -161,8 +161,9 @@ void ThreadedAssignment::parseDownstreamServers(const QJsonObject& settingsObjec
};
// manually add the downstream node to our node list
nodeList->addOrUpdateNode(QUuid::createUuid(), NodeType::downstreamType(nodeType),
downstreamServerAddr, downstreamServerAddr);
auto node = nodeList->addOrUpdateNode(QUuid::createUuid(), NodeType::downstreamType(nodeType),
downstreamServerAddr, downstreamServerAddr);
callback(*node);
}
}
}

View file

@ -18,6 +18,8 @@
#include "Assignment.h"
using DownstreamNodeFoundCallback = std::function<void(Node& downstreamNode)>;
class ThreadedAssignment : public Assignment {
Q_OBJECT
public:
@ -40,7 +42,8 @@ signals:
protected:
void commonInit(const QString& targetName, NodeType_t nodeType);
void parseDownstreamServers(const QJsonObject& settingsObject, NodeType_t nodeType);
void parseDownstreamServers(const QJsonObject& settingsObject, NodeType_t nodeType,
DownstreamNodeFoundCallback callback = [](Node& downstreamNode) {});
bool _isFinished;
QTimer _domainServerTimer;