mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 13:27:01 +02:00
Short local source IDs - checkpoint
DS assigns 16-bit IDs as well as UUIDs; ACs track mappings; nodes use short IDs in packets. Initial setup works; then fails prob. due to DS UUID.
This commit is contained in:
parent
4ec77e3af6
commit
d3464378b7
16 changed files with 91 additions and 58 deletions
assignment-client/src
domain-server/src
libraries
|
@ -842,7 +842,7 @@ void AssetServer::handleAssetUpload(QSharedPointer<ReceivedMessage> message, Sha
|
|||
|
||||
|
||||
if (canWriteToAssetServer) {
|
||||
qCDebug(asset_server) << "Starting an UploadAssetTask for upload from" << uuidStringWithoutCurlyBraces(message->getSourceID());
|
||||
qCDebug(asset_server) << "Starting an UploadAssetTask for upload from" << message->getSourceID();
|
||||
|
||||
auto task = new UploadAssetTask(message, senderNode, _filesDirectory, _filesizeLimit);
|
||||
_transferTaskPool.start(task);
|
||||
|
|
|
@ -118,7 +118,11 @@ void AudioMixer::queueReplicatedAudioPacket(QSharedPointer<ReceivedMessage> mess
|
|||
// make sure we have a replicated node for the original sender of the packet
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
QUuid nodeID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
||||
QUuid nodeID;
|
||||
SharedNodePointer sourceNode = nodeList->nodeWithLocalID(message->getSourceID());
|
||||
if (sourceNode) {
|
||||
nodeID = sourceNode->getUUID();
|
||||
}
|
||||
|
||||
auto replicatedNode = nodeList->addOrUpdateNode(nodeID, NodeType::Agent,
|
||||
message->getSenderSockAddr(), message->getSenderSockAddr(),
|
||||
|
@ -136,7 +140,7 @@ void AudioMixer::queueReplicatedAudioPacket(QSharedPointer<ReceivedMessage> mess
|
|||
|
||||
auto replicatedMessage = QSharedPointer<ReceivedMessage>::create(audioData, rewrittenType,
|
||||
versionForPacketType(rewrittenType),
|
||||
message->getSenderSockAddr(), nodeID);
|
||||
message->getSenderSockAddr(), message->getSourceID());
|
||||
|
||||
getOrCreateClientData(replicatedNode.data())->queuePacket(replicatedMessage, replicatedNode);
|
||||
}
|
||||
|
|
|
@ -112,8 +112,12 @@ void AvatarMixer::handleReplicatedPacket(QSharedPointer<ReceivedMessage> message
|
|||
void AvatarMixer::handleReplicatedBulkAvatarPacket(QSharedPointer<ReceivedMessage> message) {
|
||||
while (message->getBytesLeftToRead()) {
|
||||
// first, grab the node ID for this replicated avatar
|
||||
auto nodeID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
||||
|
||||
QUuid nodeID;
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
SharedNodePointer sourceNode = nodeList->nodeWithLocalID(message->getSourceID());
|
||||
if (sourceNode) {
|
||||
nodeID = sourceNode->getUUID();
|
||||
}
|
||||
// make sure we have an upstream replicated node that matches
|
||||
auto replicatedNode = addOrUpdateReplicatedNode(nodeID, message->getSenderSockAddr());
|
||||
|
||||
|
@ -127,7 +131,7 @@ void AvatarMixer::handleReplicatedBulkAvatarPacket(QSharedPointer<ReceivedMessag
|
|||
// construct a "fake" avatar data received message from the byte array and packet list information
|
||||
auto replicatedMessage = QSharedPointer<ReceivedMessage>::create(avatarByteArray, PacketType::AvatarData,
|
||||
versionForPacketType(PacketType::AvatarData),
|
||||
message->getSenderSockAddr(), nodeID);
|
||||
message->getSenderSockAddr(), message->getSourceID());
|
||||
|
||||
// queue up the replicated avatar data with the client data for the replicated node
|
||||
auto start = usecTimestampNow();
|
||||
|
|
|
@ -524,9 +524,10 @@ SharedNodePointer DomainGatekeeper::addVerifiedNodeFromConnectRequest(const Node
|
|||
|
||||
auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
|
||||
|
||||
Node::LocalID newLocalID = findOrCreateLocalID(nodeID);
|
||||
SharedNodePointer newNode = limitedNodeList->addOrUpdateNode(nodeID, nodeConnection.nodeType,
|
||||
nodeConnection.publicSockAddr, nodeConnection.localSockAddr);
|
||||
newNode->setLocalID(findOrCreateLocalID(nodeID));
|
||||
nodeConnection.publicSockAddr, nodeConnection.localSockAddr,
|
||||
newLocalID);
|
||||
|
||||
// So that we can send messages to this node at will - we need to activate the correct socket on this node now
|
||||
newNode->activateMatchingOrNewSymmetricSocket(discoveredSocket);
|
||||
|
|
|
@ -593,8 +593,9 @@ 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);
|
||||
SharedNodePointer sourceNode = nodeList->nodeWithUUID(sourceID);
|
||||
//QUuid sourceID = NLPacket::sourceIDInHeader(packet);
|
||||
Node::LocalID localSourceID = NLPacket::sourceIDInHeader(packet);
|
||||
SharedNodePointer sourceNode = nodeList->nodeWithLocalID(localSourceID);
|
||||
|
||||
if (sourceNode) {
|
||||
// unverified DS packets (due to a lack of connection secret between DS + node)
|
||||
|
@ -616,17 +617,17 @@ bool DomainServer::isPacketVerified(const udt::Packet& packet) {
|
|||
= LogHandler::getInstance().addRepeatedMessageRegex(UNKNOWN_REGEX);
|
||||
|
||||
qDebug() << "Packet of type" << headerType
|
||||
<< "received from unmatched IP for UUID" << uuidStringWithoutCurlyBraces(sourceID);
|
||||
<< "received from unmatched IP for UUID" << uuidStringWithoutCurlyBraces(sourceNode->getUUID());
|
||||
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
static const QString UNKNOWN_REGEX = "Packet of type \\d+ \\([\\sa-zA-Z:]+\\) received from unknown node with UUID";
|
||||
static const QString UNKNOWN_REGEX = "Packet of type \\d+ \\([\\sa-zA-Z:]+\\) received from unknown node with Local ID";
|
||||
static QString repeatedMessage
|
||||
= LogHandler::getInstance().addRepeatedMessageRegex(UNKNOWN_REGEX);
|
||||
|
||||
qDebug() << "Packet of type" << headerType
|
||||
<< "received from unknown node with UUID" << uuidStringWithoutCurlyBraces(sourceID);
|
||||
<< "received from unknown node with Local ID" << localSourceID;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -3203,13 +3204,12 @@ void DomainServer::processNodeDisconnectRequestPacket(QSharedPointer<ReceivedMes
|
|||
// This packet has been matched to a source node and they're asking not to be in the domain anymore
|
||||
auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
|
||||
|
||||
const QUuid& nodeUUID = message->getSourceID();
|
||||
|
||||
qDebug() << "Received a disconnect request from node with UUID" << nodeUUID;
|
||||
auto localID = message->getSourceID();
|
||||
qDebug() << "Received a disconnect request from node with local ID" << localID;
|
||||
|
||||
// we want to check what type this node was before going to kill it so that we can avoid sending the RemovedNode
|
||||
// packet to nodes that don't care about this type
|
||||
auto nodeToKill = limitedNodeList->nodeWithUUID(nodeUUID);
|
||||
auto nodeToKill = limitedNodeList->nodeWithLocalID(localID);
|
||||
|
||||
if (nodeToKill) {
|
||||
handleKillNode(nodeToKill);
|
||||
|
@ -3477,7 +3477,7 @@ void DomainServer::handleDomainContentReplacementFromURLRequest(QSharedPointer<R
|
|||
}
|
||||
|
||||
void DomainServer::handleOctreeFileReplacementRequest(QSharedPointer<ReceivedMessage> message) {
|
||||
auto node = DependencyManager::get<NodeList>()->nodeWithUUID(message->getSourceID());
|
||||
auto node = DependencyManager::get<NodeList>()->nodeWithLocalID(message->getSourceID());
|
||||
if (node->getCanReplaceContent()) {
|
||||
handleOctreeFileReplacement(message->readAll());
|
||||
}
|
||||
|
|
|
@ -120,8 +120,8 @@ int InboundAudioStream::parseData(ReceivedMessage& message) {
|
|||
// parse sequence number and track it
|
||||
quint16 sequence;
|
||||
message.readPrimitive(&sequence);
|
||||
SequenceNumberStats::ArrivalInfo arrivalInfo = _incomingSequenceNumberStats.sequenceNumberReceived(sequence,
|
||||
message.getSourceID());
|
||||
SequenceNumberStats::ArrivalInfo arrivalInfo = _incomingSequenceNumberStats.sequenceNumberReceived(sequence, QUuid() // TBD
|
||||
/*message.getSourceID()*/);
|
||||
QString codecInPacket = message.readString();
|
||||
|
||||
packetReceivedUpdateTimingStats();
|
||||
|
@ -186,7 +186,7 @@ int InboundAudioStream::parseData(ReceivedMessage& message) {
|
|||
_mismatchedAudioCodecCount = 0;
|
||||
|
||||
// inform others of the mismatch
|
||||
auto sendingNode = DependencyManager::get<NodeList>()->nodeWithUUID(message.getSourceID());
|
||||
auto sendingNode = DependencyManager::get<NodeList>()->nodeWithLocalID(message.getSourceID());
|
||||
if (sendingNode) {
|
||||
emit mismatchedAudioCodec(sendingNode, _selectedCodecName, codecInPacket);
|
||||
qDebug(audio) << "Codec mismatch threshold exceeded, SelectedAudioFormat(" << _selectedCodecName << " ) sent";
|
||||
|
|
|
@ -238,13 +238,16 @@ bool LimitedNodeList::packetVersionMatch(const udt::Packet& packet) {
|
|||
senderString = QString("%1:%2").arg(senderSockAddr.getAddress().toString()).arg(senderSockAddr.getPort());
|
||||
}
|
||||
} else {
|
||||
sourceID = NLPacket::sourceIDInHeader(packet);
|
||||
SharedNodePointer sourceNode = nodeWithLocalID(NLPacket::sourceIDInHeader(packet));
|
||||
if (sourceNode) {
|
||||
sourceID = sourceNode->getUUID();
|
||||
|
||||
hasBeenOutput = sourcedVersionDebugSuppressMap.contains(sourceID, headerType);
|
||||
hasBeenOutput = sourcedVersionDebugSuppressMap.contains(sourceID, headerType);
|
||||
|
||||
if (!hasBeenOutput) {
|
||||
sourcedVersionDebugSuppressMap.insert(sourceID, headerType);
|
||||
senderString = uuidStringWithoutCurlyBraces(sourceID.toString());
|
||||
if (!hasBeenOutput) {
|
||||
sourcedVersionDebugSuppressMap.insert(sourceID, headerType);
|
||||
senderString = uuidStringWithoutCurlyBraces(sourceID.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,14 +305,17 @@ bool LimitedNodeList::packetSourceAndHashMatchAndTrackBandwidth(const udt::Packe
|
|||
return true;
|
||||
}
|
||||
} else {
|
||||
QUuid sourceID = NLPacket::sourceIDInHeader(packet);
|
||||
|
||||
// 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
|
||||
SharedNodePointer matchingNode = nodeWithUUID(sourceID);
|
||||
NLPacket::LocalID sourceLocalID = NLPacket::sourceIDInHeader(packet);
|
||||
|
||||
SharedNodePointer matchingNode = nodeWithLocalID(sourceLocalID);
|
||||
sourceNode = matchingNode.data();
|
||||
}
|
||||
|
||||
QUuid sourceID = sourceNode->getUUID();
|
||||
|
||||
if (!sourceNode &&
|
||||
sourceID == getDomainUUID() &&
|
||||
|
@ -374,7 +380,7 @@ void LimitedNodeList::collectPacketStats(const NLPacket& packet) {
|
|||
|
||||
void LimitedNodeList::fillPacketHeader(const NLPacket& packet, const QUuid& connectionSecret) {
|
||||
if (!PacketTypeEnum::getNonSourcedPackets().contains(packet.getType())) {
|
||||
packet.writeSourceID(getSessionUUID());
|
||||
packet.writeSourceID(getSessionLocalID());
|
||||
}
|
||||
|
||||
if (!connectionSecret.isNull()
|
||||
|
@ -557,6 +563,16 @@ SharedNodePointer LimitedNodeList::nodeWithUUID(const QUuid& nodeUUID) {
|
|||
return it == _nodeHash.cend() ? SharedNodePointer() : it->second;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void LimitedNodeList::eraseAllNodes() {
|
||||
QSet<SharedNodePointer> killedNodes;
|
||||
|
||||
|
@ -565,6 +581,8 @@ void LimitedNodeList::eraseAllNodes() {
|
|||
// and then remove them from the hash
|
||||
QWriteLocker writeLocker(&_nodeMutex);
|
||||
|
||||
_localIDMap.erase(_localIDMap.begin(), _localIDMap.end());
|
||||
|
||||
if (_nodeHash.size() > 0) {
|
||||
qCDebug(networking) << "LimitedNodeList::eraseAllNodes() removing all nodes from NodeList.";
|
||||
|
||||
|
@ -630,7 +648,7 @@ void LimitedNodeList::handleNodeKill(const SharedNodePointer& node) {
|
|||
|
||||
SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType,
|
||||
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
||||
bool isReplicated, bool isUpstream,
|
||||
Node::LocalID localID, bool isReplicated, bool isUpstream,
|
||||
const QUuid& connectionSecret, const NodePermissions& permissions) {
|
||||
QReadLocker readLocker(&_nodeMutex);
|
||||
NodeHash::const_iterator it = _nodeHash.find(uuid);
|
||||
|
@ -644,6 +662,7 @@ SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t
|
|||
matchingNode->setConnectionSecret(connectionSecret);
|
||||
matchingNode->setIsReplicated(isReplicated);
|
||||
matchingNode->setIsUpstream(isUpstream || NodeType::isUpstream(nodeType));
|
||||
matchingNode->setLocalID(localID);
|
||||
|
||||
return matchingNode;
|
||||
} else {
|
||||
|
@ -653,6 +672,7 @@ SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t
|
|||
newNode->setIsUpstream(isUpstream || NodeType::isUpstream(nodeType));
|
||||
newNode->setConnectionSecret(connectionSecret);
|
||||
newNode->setPermissions(permissions);
|
||||
newNode->setLocalID(localID);
|
||||
|
||||
// move the newly constructed node to the LNL thread
|
||||
newNode->moveToThread(thread());
|
||||
|
@ -693,6 +713,7 @@ SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t
|
|||
#else
|
||||
_nodeHash.emplace(newNode->getUUID(), newNodePointer);
|
||||
#endif
|
||||
_localIDMap.emplace(localID, newNodePointer);
|
||||
readLocker.unlock();
|
||||
|
||||
qCDebug(networking) << "Added" << *newNode;
|
||||
|
|
|
@ -157,10 +157,11 @@ public:
|
|||
size_t size() const { QReadLocker readLock(&_nodeMutex); return _nodeHash.size(); }
|
||||
|
||||
SharedNodePointer nodeWithUUID(const QUuid& nodeUUID);
|
||||
SharedNodePointer nodeWithLocalID(Node::LocalID localID) const;
|
||||
|
||||
SharedNodePointer addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType,
|
||||
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
||||
bool isReplicated = false, bool isUpstream = false,
|
||||
Node::LocalID localID = 0, bool isReplicated = false, bool isUpstream = false,
|
||||
const QUuid& connectionSecret = QUuid(),
|
||||
const NodePermissions& permissions = DEFAULT_AGENT_PERMISSIONS);
|
||||
|
||||
|
@ -429,6 +430,8 @@ private slots:
|
|||
private:
|
||||
mutable QReadWriteLock _sessionUUIDLock;
|
||||
QUuid _sessionUUID;
|
||||
using LocalIDMapping = std::unordered_map<Node::LocalID, SharedNodePointer>;
|
||||
LocalIDMapping _localIDMap;
|
||||
Node::LocalID _sessionLocalID { 0 };
|
||||
};
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
int NLPacket::localHeaderSize(PacketType type) {
|
||||
bool nonSourced = PacketTypeEnum::getNonSourcedPackets().contains(type);
|
||||
bool nonVerified = PacketTypeEnum::getNonVerifiedPackets().contains(type);
|
||||
qint64 optionalSize = (nonSourced ? 0 : NUM_BYTES_RFC4122_UUID) + ((nonSourced || nonVerified) ? 0 : NUM_BYTES_MD5_HASH);
|
||||
qint64 optionalSize = (nonSourced ? 0 : NUM_BYTES_LOCALID) + ((nonSourced || nonVerified) ? 0 : NUM_BYTES_MD5_HASH);
|
||||
return sizeof(PacketType) + sizeof(PacketVersion) + optionalSize;
|
||||
}
|
||||
int NLPacket::totalHeaderSize(PacketType type, bool isPartOfMessage) {
|
||||
|
@ -139,13 +139,14 @@ PacketVersion NLPacket::versionInHeader(const udt::Packet& packet) {
|
|||
return *reinterpret_cast<const PacketVersion*>(packet.getData() + headerOffset + sizeof(PacketType));
|
||||
}
|
||||
|
||||
QUuid NLPacket::sourceIDInHeader(const udt::Packet& packet) {
|
||||
NLPacket::LocalID NLPacket::sourceIDInHeader(const udt::Packet& packet) {
|
||||
int offset = Packet::totalHeaderSize(packet.isPartOfMessage()) + sizeof(PacketType) + sizeof(PacketVersion);
|
||||
return QUuid::fromRfc4122(QByteArray::fromRawData(packet.getData() + offset, NUM_BYTES_RFC4122_UUID));
|
||||
return *reinterpret_cast<const LocalID*>(packet.getData() + offset);
|
||||
}
|
||||
|
||||
QByteArray NLPacket::verificationHashInHeader(const udt::Packet& packet) {
|
||||
int offset = Packet::totalHeaderSize(packet.isPartOfMessage()) + sizeof(PacketType) + sizeof(PacketVersion) + NUM_BYTES_RFC4122_UUID;
|
||||
int offset = Packet::totalHeaderSize(packet.isPartOfMessage()) + sizeof(PacketType) +
|
||||
sizeof(PacketVersion) + NUM_BYTES_LOCALID;
|
||||
return QByteArray(packet.getData() + offset, NUM_BYTES_MD5_HASH);
|
||||
}
|
||||
|
||||
|
@ -153,7 +154,7 @@ QByteArray NLPacket::hashForPacketAndSecret(const udt::Packet& packet, const QUu
|
|||
QCryptographicHash hash(QCryptographicHash::Md5);
|
||||
|
||||
int offset = Packet::totalHeaderSize(packet.isPartOfMessage()) + sizeof(PacketType) + sizeof(PacketVersion)
|
||||
+ NUM_BYTES_RFC4122_UUID + NUM_BYTES_MD5_HASH;
|
||||
+ NUM_BYTES_LOCALID + NUM_BYTES_MD5_HASH;
|
||||
|
||||
// add the packet payload and the connection UUID
|
||||
hash.addData(packet.getData() + offset, packet.getDataSize() - offset);
|
||||
|
@ -203,11 +204,12 @@ void NLPacket::readSourceID() {
|
|||
}
|
||||
}
|
||||
|
||||
void NLPacket::writeSourceID(const QUuid& sourceID) const {
|
||||
void NLPacket::writeSourceID(LocalID sourceID) const {
|
||||
Q_ASSERT(!PacketTypeEnum::getNonSourcedPackets().contains(_type));
|
||||
|
||||
auto offset = Packet::totalHeaderSize(isPartOfMessage()) + sizeof(PacketType) + sizeof(PacketVersion);
|
||||
memcpy(_packet.get() + offset, sourceID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID);
|
||||
|
||||
memcpy(_packet.get() + offset, &sourceID, sizeof(sourceID));
|
||||
|
||||
_sourceID = sourceID;
|
||||
}
|
||||
|
@ -217,7 +219,7 @@ void NLPacket::writeVerificationHashGivenSecret(const QUuid& connectionSecret) c
|
|||
!PacketTypeEnum::getNonVerifiedPackets().contains(_type));
|
||||
|
||||
auto offset = Packet::totalHeaderSize(isPartOfMessage()) + sizeof(PacketType) + sizeof(PacketVersion)
|
||||
+ NUM_BYTES_RFC4122_UUID;
|
||||
+ NUM_BYTES_LOCALID;
|
||||
QByteArray verificationHash = hashForPacketAndSecret(*this, connectionSecret);
|
||||
|
||||
memcpy(_packet.get() + offset, verificationHash.data(), verificationHash.size());
|
||||
|
|
|
@ -43,10 +43,12 @@ public:
|
|||
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
||||
// NLPacket Header Format
|
||||
|
||||
using LocalID = qint16;
|
||||
static const int NUM_BYTES_LOCALID = sizeof(LocalID);
|
||||
// this is used by the Octree classes - must be known at compile time
|
||||
static const int MAX_PACKET_HEADER_SIZE =
|
||||
sizeof(udt::Packet::SequenceNumberAndBitField) + sizeof(udt::Packet::MessageNumberAndBitField) +
|
||||
sizeof(PacketType) + sizeof(PacketVersion) + NUM_BYTES_RFC4122_UUID + NUM_BYTES_MD5_HASH;
|
||||
sizeof(PacketType) + sizeof(PacketVersion) + NUM_BYTES_LOCALID + NUM_BYTES_MD5_HASH;
|
||||
|
||||
static std::unique_ptr<NLPacket> create(PacketType type, qint64 size = -1,
|
||||
bool isReliable = false, bool isPartOfMessage = false, PacketVersion version = 0);
|
||||
|
@ -69,7 +71,7 @@ public:
|
|||
static PacketType typeInHeader(const udt::Packet& packet);
|
||||
static PacketVersion versionInHeader(const udt::Packet& packet);
|
||||
|
||||
static QUuid sourceIDInHeader(const udt::Packet& packet);
|
||||
static LocalID sourceIDInHeader(const udt::Packet& packet);
|
||||
static QByteArray verificationHashInHeader(const udt::Packet& packet);
|
||||
static QByteArray hashForPacketAndSecret(const udt::Packet& packet, const QUuid& connectionSecret);
|
||||
|
||||
|
@ -79,9 +81,9 @@ public:
|
|||
PacketVersion getVersion() const { return _version; }
|
||||
void setVersion(PacketVersion version);
|
||||
|
||||
const QUuid& getSourceID() const { return _sourceID; }
|
||||
LocalID getSourceID() const { return _sourceID; }
|
||||
|
||||
void writeSourceID(const QUuid& sourceID) const;
|
||||
void writeSourceID(qint16 sourceID) const;
|
||||
void writeVerificationHashGivenSecret(const QUuid& connectionSecret) const;
|
||||
|
||||
protected:
|
||||
|
@ -106,7 +108,7 @@ protected:
|
|||
|
||||
PacketType _type;
|
||||
PacketVersion _version;
|
||||
mutable QUuid _sourceID;
|
||||
mutable LocalID _sourceID;
|
||||
};
|
||||
|
||||
#endif // hifi_NLPacket_h
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
bool isReliable = false, bool isOrdered = false);
|
||||
|
||||
PacketVersion getVersion() const { return _packetVersion; }
|
||||
const QUuid& getSourceID() const { return _sourceID; }
|
||||
NLPacket::LocalID getSourceID() const { return _sourceID; }
|
||||
|
||||
qint64 getMaxSegmentSize() const override { return NLPacket::maxPayloadSize(_packetType, _isOrdered); }
|
||||
|
||||
|
@ -37,7 +37,7 @@ private:
|
|||
|
||||
|
||||
PacketVersion _packetVersion;
|
||||
QUuid _sourceID;
|
||||
NLPacket::LocalID _sourceID;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QSharedPointer<NLPacketList>)
|
||||
|
|
|
@ -659,9 +659,8 @@ void NodeList::parseNodeFromPacketStream(QDataStream& packetStream) {
|
|||
|
||||
packetStream >> connectionSecretUUID;
|
||||
|
||||
SharedNodePointer node = addOrUpdateNode(nodeUUID, nodeType, nodePublicSocket,
|
||||
nodeLocalSocket, isReplicated, false, connectionSecretUUID, permissions);
|
||||
node->setLocalID(sessionLocalID);
|
||||
SharedNodePointer node = addOrUpdateNode(nodeUUID, nodeType, nodePublicSocket, nodeLocalSocket,
|
||||
sessionLocalID, isReplicated, false, connectionSecretUUID, permissions);
|
||||
|
||||
// nodes that are downstream or upstream of our own type are kept alive when we hear about them from the domain server
|
||||
// and always have their public socket as their active socket
|
||||
|
|
|
@ -261,10 +261,7 @@ void PacketReceiver::handleVerifiedMessage(QSharedPointer<ReceivedMessage> recei
|
|||
|
||||
SharedNodePointer matchingNode;
|
||||
|
||||
if (!receivedMessage->getSourceID().isNull()) {
|
||||
matchingNode = nodeList->nodeWithUUID(receivedMessage->getSourceID());
|
||||
}
|
||||
|
||||
matchingNode = nodeList->nodeWithLocalID(receivedMessage->getSourceID());
|
||||
QMutexLocker packetListenerLocker(&_packetListenerLock);
|
||||
|
||||
auto it = _messageListenerMap.find(receivedMessage->getType());
|
||||
|
|
|
@ -43,7 +43,7 @@ ReceivedMessage::ReceivedMessage(NLPacket& packet)
|
|||
}
|
||||
|
||||
ReceivedMessage::ReceivedMessage(QByteArray byteArray, PacketType packetType, PacketVersion packetVersion,
|
||||
const HifiSockAddr& senderSockAddr, QUuid sourceID) :
|
||||
const HifiSockAddr& senderSockAddr, NLPacket::LocalID sourceID) :
|
||||
_data(byteArray),
|
||||
_headData(_data.mid(0, HEAD_DATA_SIZE)),
|
||||
_numPackets(1),
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
ReceivedMessage(const NLPacketList& packetList);
|
||||
ReceivedMessage(NLPacket& packet);
|
||||
ReceivedMessage(QByteArray byteArray, PacketType packetType, PacketVersion packetVersion,
|
||||
const HifiSockAddr& senderSockAddr, QUuid sourceID = QUuid());
|
||||
const HifiSockAddr& senderSockAddr, NLPacket::LocalID sourceID = 0);
|
||||
|
||||
QByteArray getMessage() const { return _data; }
|
||||
const char* getRawMessage() const { return _data.constData(); }
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
bool failed() const { return _failed; }
|
||||
bool isComplete() const { return _isComplete; }
|
||||
|
||||
const QUuid& getSourceID() const { return _sourceID; }
|
||||
NLPacket::LocalID getSourceID() const { return _sourceID; }
|
||||
const HifiSockAddr& getSenderSockAddr() { return _senderSockAddr; }
|
||||
|
||||
qint64 getPosition() const { return _position; }
|
||||
|
@ -93,7 +93,7 @@ private:
|
|||
std::atomic<qint64> _position { 0 };
|
||||
std::atomic<qint64> _numPackets { 0 };
|
||||
|
||||
QUuid _sourceID;
|
||||
NLPacket::LocalID _sourceID;
|
||||
PacketType _packetType;
|
||||
PacketVersion _packetVersion;
|
||||
HifiSockAddr _senderSockAddr;
|
||||
|
|
|
@ -96,7 +96,7 @@ void OctreeProcessor::processDatagram(ReceivedMessage& message, SharedNodePointe
|
|||
quint64 totalUncompress = 0;
|
||||
quint64 totalReadBitsteam = 0;
|
||||
|
||||
const QUuid& sourceUUID = message.getSourceID();
|
||||
const QUuid& sourceUUID = sourceNode->getUUID();
|
||||
|
||||
int subsection = 1;
|
||||
|
||||
|
|
Loading…
Reference in a new issue