mirror of
https://github.com/overte-org/overte.git
synced 2025-04-11 09:52:20 +02:00
Local IDs - add an explicit null value, use it for replicated packets
This commit is contained in:
parent
734b48eee0
commit
efb1fdbc0d
6 changed files with 9 additions and 5 deletions
assignment-client/src
domain-server/src
libraries/networking/src
|
@ -137,7 +137,7 @@ void AudioMixer::queueReplicatedAudioPacket(QSharedPointer<ReceivedMessage> mess
|
|||
|
||||
auto replicatedMessage = QSharedPointer<ReceivedMessage>::create(audioData, rewrittenType,
|
||||
versionForPacketType(rewrittenType),
|
||||
message->getSenderSockAddr(), message->getSourceID());
|
||||
message->getSenderSockAddr(), Node::NULL_LOCAL_ID);
|
||||
|
||||
getOrCreateClientData(replicatedNode.data())->queuePacket(replicatedMessage, replicatedNode);
|
||||
}
|
||||
|
|
|
@ -127,7 +127,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(), message->getSourceID());
|
||||
message->getSenderSockAddr(), Node::NULL_LOCAL_ID);
|
||||
|
||||
// queue up the replicated avatar data with the client data for the replicated node
|
||||
auto start = usecTimestampNow();
|
||||
|
|
|
@ -1039,7 +1039,7 @@ Node::LocalID DomainGatekeeper::findOrCreateLocalID(const QUuid& uuid) {
|
|||
do {
|
||||
newLocalID = _currentLocalID;
|
||||
_currentLocalID += _idIncrement;
|
||||
} while (newLocalID == 0 || _localIDs.find(newLocalID) != _localIDs.end());
|
||||
} while (newLocalID == Node::NULL_LOCAL_ID || _localIDs.find(newLocalID) != _localIDs.end());
|
||||
|
||||
_uuidToLocalID.emplace(uuid, newLocalID);
|
||||
_localIDs.insert(newLocalID);
|
||||
|
|
|
@ -38,6 +38,8 @@ public:
|
|||
//
|
||||
|
||||
using LocalID = NetworkLocalID;
|
||||
static const LocalID NULL_LOCAL_ID = 0;
|
||||
|
||||
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 =
|
||||
|
|
|
@ -41,6 +41,8 @@ public:
|
|||
void setUUID(const QUuid& uuid) { _uuid = uuid; }
|
||||
|
||||
using LocalID = NetworkLocalID;
|
||||
static const LocalID NULL_LOCAL_ID = 0;
|
||||
|
||||
LocalID getLocalID() const { return _localID; }
|
||||
void setLocalID(LocalID localID) { _localID = localID; }
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
ReceivedMessage(const NLPacketList& packetList);
|
||||
ReceivedMessage(NLPacket& packet);
|
||||
ReceivedMessage(QByteArray byteArray, PacketType packetType, PacketVersion packetVersion,
|
||||
const HifiSockAddr& senderSockAddr, NLPacket::LocalID sourceID = 0);
|
||||
const HifiSockAddr& senderSockAddr, NLPacket::LocalID sourceID = NLPacket::NULL_LOCAL_ID);
|
||||
|
||||
QByteArray getMessage() const { return _data; }
|
||||
const char* getRawMessage() const { return _data.constData(); }
|
||||
|
@ -93,7 +93,7 @@ private:
|
|||
std::atomic<qint64> _position { 0 };
|
||||
std::atomic<qint64> _numPackets { 0 };
|
||||
|
||||
NLPacket::LocalID _sourceID;
|
||||
NLPacket::LocalID _sourceID { NLPacket::NULL_LOCAL_ID };
|
||||
PacketType _packetType;
|
||||
PacketVersion _packetVersion;
|
||||
HifiSockAddr _senderSockAddr;
|
||||
|
|
Loading…
Reference in a new issue