Add isReplicant to node list packet processing

This commit is contained in:
Ryan Huffman 2017-06-12 12:11:16 -07:00
parent ff2800e8d5
commit 2ff065f751
5 changed files with 12 additions and 8 deletions

View file

@ -569,6 +569,7 @@ void LimitedNodeList::handleNodeKill(const SharedNodePointer& node) {
SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType,
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
const NodePermissions& permissions,
bool isReplicant,
const QUuid& connectionSecret) {
QReadLocker readLocker(&_nodeMutex);
NodeHash::const_iterator it = _nodeHash.find(uuid);
@ -580,11 +581,12 @@ SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t
matchingNode->setLocalSocket(localSocket);
matchingNode->setPermissions(permissions);
matchingNode->setConnectionSecret(connectionSecret);
matchingNode->setIsReplicant(isReplicant);
return matchingNode;
} else {
// 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, isReplicant, connectionSecret, this);
if (nodeType == NodeType::AudioMixer) {
LimitedNodeList::flagTimeForConnectionStep(LimitedNodeList::AddedAudioMixer);

View file

@ -146,7 +146,7 @@ public:
SharedNodePointer addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType,
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
const NodePermissions& permissions = DEFAULT_AGENT_PERMISSIONS,
const QUuid& connectionSecret = QUuid());
bool isReplicant = false, const QUuid& connectionSecret = QUuid());
static bool parseSTUNResponse(udt::BasePacket* packet, QHostAddress& newPublicAddress, uint16_t& newPublicPort);
bool hasCompletedInitialSTUN() const { return _hasCompletedInitialSTUN; }

View file

@ -51,11 +51,12 @@ const QString& NodeType::getNodeTypeName(NodeType_t nodeType) {
}
Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket,
const HifiSockAddr& localSocket, const NodePermissions& permissions, const QUuid& connectionSecret,
QObject* parent) :
const HifiSockAddr& localSocket, const NodePermissions& permissions, bool isReplicant,
const QUuid& connectionSecret, QObject* parent) :
NetworkPeer(uuid, publicSocket, localSocket, parent),
_type(type),
_connectionSecret(connectionSecret),
_isReplicant(isReplicant),
_pingMs(-1), // "Uninitialized"
_clockSkewUsec(0),
_mutex(),

View file

@ -39,8 +39,8 @@ class Node : public NetworkPeer {
public:
Node(const QUuid& uuid, NodeType_t type,
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
const NodePermissions& permissions, const QUuid& connectionSecret = QUuid(),
QObject* parent = nullptr);
const NodePermissions& permissions, bool isReplicant, const QUuid& connectionSecret = QUuid(),
QObject* parent = 0);
bool operator==(const Node& otherNode) const { return _uuid == otherNode._uuid; }
bool operator!=(const Node& otherNode) const { return !(*this == otherNode); }

View file

@ -654,8 +654,9 @@ void NodeList::parseNodeFromPacketStream(QDataStream& packetStream) {
QUuid nodeUUID, connectionUUID;
HifiSockAddr nodePublicSocket, nodeLocalSocket;
NodePermissions permissions;
bool isReplicant;
packetStream >> nodeType >> nodeUUID >> nodePublicSocket >> nodeLocalSocket >> permissions;
packetStream >> nodeType >> nodeUUID >> nodePublicSocket >> nodeLocalSocket >> permissions >> isReplicant;
// if the public socket address is 0 then it's reachable at the same IP
// as the domain server
@ -666,7 +667,7 @@ void NodeList::parseNodeFromPacketStream(QDataStream& packetStream) {
packetStream >> connectionUUID;
SharedNodePointer node = addOrUpdateNode(nodeUUID, nodeType, nodePublicSocket,
nodeLocalSocket, permissions, connectionUUID);
nodeLocalSocket, permissions, isReplicant, connectionUUID);
}
void NodeList::sendAssignment(Assignment& assignment) {