Add domain local ID to DomainServerList

Also handle domain local ID for 'domain sourced' packets;
bump packet version.
This commit is contained in:
Simon Walton 2018-03-28 13:27:43 -07:00
parent bed4033554
commit f823f63211
7 changed files with 11 additions and 8 deletions

View file

@ -593,7 +593,6 @@ bool DomainServer::isPacketVerified(const udt::Packet& packet) {
if (!PacketTypeEnum::getNonSourcedPackets().contains(headerType)) {
// this is a sourced packet - first check if we have a node that matches
//QUuid sourceID = NLPacket::sourceIDInHeader(packet);
Node::LocalID localSourceID = NLPacket::sourceIDInHeader(packet);
SharedNodePointer sourceNode = nodeList->nodeWithLocalID(localSourceID);

View file

@ -45,6 +45,9 @@ public:
const QUuid& getUUID() const { return _uuid; }
void setUUID(const QUuid& uuid);
const Node::LocalID getLocalID() const { return _localID; }
void setLocalID(Node::LocalID localID) { _localID = localID; }
QString getHostname() const { return _domainURL.host(); }
const QHostAddress& getIP() const { return _sockAddr.getAddress(); }
@ -181,6 +184,7 @@ private:
void hardReset();
QUuid _uuid;
Node::LocalID _localID;
QUrl _domainURL;
HifiSockAddr _sockAddr;
QUuid _assignmentUUID;

View file

@ -305,11 +305,11 @@ bool LimitedNodeList::packetSourceAndHashMatchAndTrackBandwidth(const udt::Packe
return true;
}
} else {
NLPacket::LocalID sourceLocalID = 0;
// check if we were passed a sourceNode hint or if we need to look it up
if (!sourceNode) {
// figure out which node this is from
NLPacket::LocalID sourceLocalID = NLPacket::sourceIDInHeader(packet);
sourceLocalID = NLPacket::sourceIDInHeader(packet);
SharedNodePointer matchingNode = nodeWithLocalID(sourceLocalID);
sourceNode = matchingNode.data();
@ -318,7 +318,7 @@ bool LimitedNodeList::packetSourceAndHashMatchAndTrackBandwidth(const udt::Packe
QUuid sourceID = sourceNode ? sourceNode->getUUID() : QUuid();
if (!sourceNode &&
/*sourceID == getDomainUUID() &&*/
sourceLocalID == getDomainLocalID() &&
packet.getSenderSockAddr() == getDomainSockAddr() &&
PacketTypeEnum::getDomainSourcedPackets().contains(headerType)) {
// This is a packet sourced by the domain server
@ -567,9 +567,6 @@ SharedNodePointer LimitedNodeList::nodeWithLocalID(Node::LocalID localID) const
QReadLocker readLocker(&_nodeMutex);
LocalIDMapping::const_iterator idIter = _localIDMap.find(localID);
if (idIter == _localIDMap.cend()) {
qCDebug(networking) << "No such Node with local ID " << localID;
}
return idIter == _localIDMap.cend() ? nullptr : idIter->second;
}

View file

@ -128,6 +128,7 @@ public:
virtual bool isDomainServer() const { return true; }
virtual QUuid getDomainUUID() const { assert(false); return QUuid(); }
virtual Node::LocalID getDomainLocalID() const { assert(false); return 0; }
virtual HifiSockAddr getDomainSockAddr() const { assert(false); return HifiSockAddr(); }
// use sendUnreliablePacket to send an unrelaible packet (that you do not need to move)

View file

@ -608,6 +608,7 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
// if this was the first domain-server list from this domain, we've now connected
if (!_domainHandler.isConnected()) {
_domainHandler.setLocalID(newLocalID);
_domainHandler.setUUID(domainUUID);
_domainHandler.setIsConnected(true);

View file

@ -94,6 +94,7 @@ public:
virtual bool isDomainServer() const override { return false; }
virtual QUuid getDomainUUID() const override { return _domainHandler.getUUID(); }
virtual Node::LocalID getDomainLocalID() const override { return _domainHandler.getLocalID(); }
virtual HifiSockAddr getDomainSockAddr() const override { return _domainHandler.getSockAddr(); }
public slots:

View file

@ -76,7 +76,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
case PacketType::DomainSettings:
return 18; // replace min_avatar_scale and max_avatar_scale with min_avatar_height and max_avatar_height
default:
return 17;
return 19;
}
}