mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 16:23:17 +02:00
reset sent trait data when re-send required
This commit is contained in:
parent
1320a34a18
commit
36784b0039
3 changed files with 25 additions and 8 deletions
|
@ -542,6 +542,7 @@ void AvatarMixer::handleRequestsDomainListDataPacket(QSharedPointer<ReceivedMess
|
||||||
// so that the AvatarMixer will send Identity data to us
|
// so that the AvatarMixer will send Identity data to us
|
||||||
[&](const SharedNodePointer& node) {
|
[&](const SharedNodePointer& node) {
|
||||||
nodeData->setLastBroadcastTime(node->getUUID(), 0);
|
nodeData->setLastBroadcastTime(node->getUUID(), 0);
|
||||||
|
nodeData->resetSentTraitData(node->getLocalID());
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -588,10 +589,10 @@ void AvatarMixer::handleAvatarIdentityRequestPacket(QSharedPointer<ReceivedMessa
|
||||||
QUuid avatarID(QUuid::fromRfc4122(message->getMessage()) );
|
QUuid avatarID(QUuid::fromRfc4122(message->getMessage()) );
|
||||||
if (!avatarID.isNull()) {
|
if (!avatarID.isNull()) {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
auto node = nodeList->nodeWithUUID(avatarID);
|
auto requestedNode = nodeList->nodeWithUUID(avatarID);
|
||||||
if (node) {
|
|
||||||
QMutexLocker lock(&node->getMutex());
|
if (requestedNode) {
|
||||||
AvatarMixerClientData* avatarClientData = dynamic_cast<AvatarMixerClientData*>(node->getLinkedData());
|
AvatarMixerClientData* avatarClientData = static_cast<AvatarMixerClientData*>(requestedNode->getLinkedData());
|
||||||
if (avatarClientData) {
|
if (avatarClientData) {
|
||||||
const AvatarData& avatarData = avatarClientData->getAvatar();
|
const AvatarData& avatarData = avatarClientData->getAvatar();
|
||||||
QByteArray serializedAvatar = avatarData.identityByteArray();
|
QByteArray serializedAvatar = avatarData.identityByteArray();
|
||||||
|
@ -600,6 +601,11 @@ void AvatarMixer::handleAvatarIdentityRequestPacket(QSharedPointer<ReceivedMessa
|
||||||
nodeList->sendPacketList(std::move(identityPackets), *senderNode);
|
nodeList->sendPacketList(std::move(identityPackets), *senderNode);
|
||||||
++_sumIdentityPackets;
|
++_sumIdentityPackets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AvatarMixerClientData* senderData = static_cast<AvatarMixerClientData*>(senderNode->getLinkedData());
|
||||||
|
if (senderData) {
|
||||||
|
senderData->resetSentTraitData(requestedNode->getLocalID());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -625,23 +631,24 @@ void AvatarMixer::handleNodeIgnoreRequestPacket(QSharedPointer<ReceivedMessage>
|
||||||
while (message->getBytesLeftToRead()) {
|
while (message->getBytesLeftToRead()) {
|
||||||
// parse out the UUID being ignored from the packet
|
// parse out the UUID being ignored from the packet
|
||||||
QUuid ignoredUUID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
QUuid ignoredUUID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
||||||
|
auto ignoredNode = nodeList->nodeWithUUID(ignoredUUID);
|
||||||
if (nodeList->nodeWithUUID(ignoredUUID)) {
|
if (ignoredNode) {
|
||||||
if (nodeData) {
|
if (nodeData) {
|
||||||
// Reset the lastBroadcastTime for the ignored avatar to 0
|
// Reset the lastBroadcastTime for the ignored avatar to 0
|
||||||
// so the AvatarMixer knows it'll have to send identity data about the ignored avatar
|
// so the AvatarMixer knows it'll have to send identity data about the ignored avatar
|
||||||
// to the ignorer if the ignorer unignores.
|
// to the ignorer if the ignorer unignores.
|
||||||
nodeData->setLastBroadcastTime(ignoredUUID, 0);
|
nodeData->setLastBroadcastTime(ignoredUUID, 0);
|
||||||
|
nodeData->resetSentTraitData(ignoredNode->getLocalID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Reset the lastBroadcastTime for the ignorer (FROM THE PERSPECTIVE OF THE IGNORED) to 0
|
// Reset the lastBroadcastTime for the ignorer (FROM THE PERSPECTIVE OF THE IGNORED) to 0
|
||||||
// so the AvatarMixer knows it'll have to send identity data about the ignorer
|
// so the AvatarMixer knows it'll have to send identity data about the ignorer
|
||||||
// to the ignored if the ignorer unignores.
|
// to the ignored if the ignorer unignores.
|
||||||
auto ignoredNode = nodeList->nodeWithUUID(ignoredUUID);
|
|
||||||
AvatarMixerClientData* ignoredNodeData = reinterpret_cast<AvatarMixerClientData*>(ignoredNode->getLinkedData());
|
AvatarMixerClientData* ignoredNodeData = reinterpret_cast<AvatarMixerClientData*>(ignoredNode->getLinkedData());
|
||||||
if (ignoredNodeData) {
|
if (ignoredNodeData) {
|
||||||
ignoredNodeData->setLastBroadcastTime(senderNode->getUUID(), 0);
|
ignoredNodeData->setLastBroadcastTime(senderNode->getUUID(), 0);
|
||||||
|
ignoredNodeData->resetSentTraitData(senderNode->getLocalID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -228,6 +228,9 @@ void AvatarMixerClientData::ignoreOther(SharedNodePointer self, SharedNodePointe
|
||||||
killPacket->writePrimitive(KillAvatarReason::YourAvatarEnteredTheirBubble);
|
killPacket->writePrimitive(KillAvatarReason::YourAvatarEnteredTheirBubble);
|
||||||
}
|
}
|
||||||
setLastBroadcastTime(other->getUUID(), 0);
|
setLastBroadcastTime(other->getUUID(), 0);
|
||||||
|
|
||||||
|
resetSentTraitData(other->getLocalID());
|
||||||
|
|
||||||
DependencyManager::get<NodeList>()->sendPacket(std::move(killPacket), *self);
|
DependencyManager::get<NodeList>()->sendPacket(std::move(killPacket), *self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,6 +241,11 @@ void AvatarMixerClientData::removeFromRadiusIgnoringSet(SharedNodePointer self,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AvatarMixerClientData::resetSentTraitData(Node::LocalID nodeLocalID) {
|
||||||
|
_lastSentTraitsTimestamps[nodeLocalID] = TraitsCheckTimestamp();
|
||||||
|
_sentTraitVersions[nodeLocalID].reset();
|
||||||
|
}
|
||||||
|
|
||||||
void AvatarMixerClientData::readViewFrustumPacket(const QByteArray& message) {
|
void AvatarMixerClientData::readViewFrustumPacket(const QByteArray& message) {
|
||||||
_currentViewFrustums.clear();
|
_currentViewFrustums.clear();
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,8 @@ public:
|
||||||
|
|
||||||
AvatarTraits::TraitVersions& getLastSentTraitVersions(Node::LocalID otherAvatar) { return _sentTraitVersions[otherAvatar]; }
|
AvatarTraits::TraitVersions& getLastSentTraitVersions(Node::LocalID otherAvatar) { return _sentTraitVersions[otherAvatar]; }
|
||||||
|
|
||||||
|
void resetSentTraitData(Node::LocalID nodeID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PacketQueue : public std::queue<QSharedPointer<ReceivedMessage>> {
|
struct PacketQueue : public std::queue<QSharedPointer<ReceivedMessage>> {
|
||||||
QWeakPointer<Node> node;
|
QWeakPointer<Node> node;
|
||||||
|
|
Loading…
Reference in a new issue