requestsDomainsListData

This commit is contained in:
howard-stearns 2016-12-21 16:12:00 -08:00 committed by Zach Fox
parent 9128d4b140
commit 0ad9786f6b
10 changed files with 72 additions and 8 deletions

View file

@ -50,6 +50,7 @@ AvatarMixer::AvatarMixer(ReceivedMessage& message) :
packetReceiver.registerListener(PacketType::KillAvatar, this, "handleKillAvatarPacket");
packetReceiver.registerListener(PacketType::NodeIgnoreRequest, this, "handleNodeIgnoreRequestPacket");
packetReceiver.registerListener(PacketType::RadiusIgnoreRequest, this, "handleRadiusIgnoreRequestPacket");
packetReceiver.registerListener(PacketType::RequestDomainListData, this, "handleRequestDomainListDataPacket");
auto nodeList = DependencyManager::get<NodeList>();
connect(nodeList.data(), &NodeList::packetVersionMismatch, this, &AvatarMixer::handlePacketVersionMismatch);
@ -205,6 +206,11 @@ void AvatarMixer::broadcastAvatarData() {
// use the data rate specifically for avatar data for FRD adjustment checks
float avatarDataRateLastSecond = nodeData->getOutboundAvatarDataKbps();
// send extra data that is otherwise surpressed
bool getsOutOfView = nodeData->getRequestsDomainListData();
bool getsAnyIgnored = node->getCanKick();
bool getsIgnoredByMe = getsAnyIgnored || nodeData->getRequestsDomainListData();
// Check if it is time to adjust what we send this client based on the observed
// bandwidth to this node. We do this once a second, which is also the window for
// the bandwidth reported by node->getOutboundBandwidth();
@ -275,14 +281,14 @@ void AvatarMixer::broadcastAvatarData() {
// or that has ignored the viewing node
if (!otherNode->getLinkedData()
|| otherNode->getUUID() == node->getUUID()
|| node->isIgnoringNodeWithID(otherNode->getUUID())
|| otherNode->isIgnoringNodeWithID(node->getUUID())) {
|| (node->isIgnoringNodeWithID(otherNode->getUUID()) && !getsIgnoredByMe)
|| (otherNode->isIgnoringNodeWithID(node->getUUID()) && !getsAnyIgnored)) {
return false;
} else {
AvatarMixerClientData* otherData = reinterpret_cast<AvatarMixerClientData*>(otherNode->getLinkedData());
AvatarMixerClientData* nodeData = reinterpret_cast<AvatarMixerClientData*>(node->getLinkedData());
// Check to see if the space bubble is enabled
if (node->isIgnoreRadiusEnabled() || otherNode->isIgnoreRadiusEnabled()) {
if ((node->isIgnoreRadiusEnabled() && !getsIgnoredByMe) || (otherNode->isIgnoreRadiusEnabled() && !getsAnyIgnored)) {
// Define the minimum bubble size
static const glm::vec3 minBubbleSize = glm::vec3(0.3f, 1.3f, 0.3f);
// Define the scale of the box for the current node
@ -333,7 +339,7 @@ void AvatarMixer::broadcastAvatarData() {
&& (forceSend
|| otherNodeData->getIdentityChangeTimestamp() > _lastFrameTimestamp
|| distribution(generator) < IDENTITY_SEND_PROBABILITY)) {
qDebug() << "FIXME HRS sending identity to" << node->getUUID() << "from" << otherNode->getUUID();
sendIdentityPacket(otherNodeData, node);
}
@ -349,6 +355,7 @@ void AvatarMixer::broadcastAvatarData() {
maxAvatarDistanceThisFrame = std::max(maxAvatarDistanceThisFrame, distanceToAvatar);
if (distanceToAvatar != 0.0f
&& !getsOutOfView
&& distribution(generator) > (nodeData->getFullRateDistance() / distanceToAvatar)) {
return;
}
@ -388,7 +395,7 @@ void AvatarMixer::broadcastAvatarData() {
AABox otherNodeBox(otherNodeData->getGlobalBoundingBoxCorner(), otherNodeBoxScale);
AvatarData::AvatarDataDetail detail;
if (!nodeData->otherAvatarInView(otherNodeBox)) {
if (!nodeData->otherAvatarInView(otherNodeBox) && !getsOutOfView) {
detail = AvatarData::MinimumData;
nodeData->incrementAvatarOutOfView();
} else {
@ -396,6 +403,7 @@ void AvatarMixer::broadcastAvatarData() {
? AvatarData::SendAllData : AvatarData::IncludeSmallData;
nodeData->incrementAvatarInView();
}
//qDebug() << "FIXME HRS sending" << detail << "to" << node->getUUID() << "from" << otherNode->getUUID();
numAvatarDataBytes += avatarPacketList->write(otherNode->getUUID().toRfc4122());
numAvatarDataBytes += avatarPacketList->write(otherAvatar.toByteArray(detail));
@ -527,6 +535,22 @@ void AvatarMixer::handleViewFrustumPacket(QSharedPointer<ReceivedMessage> messag
}
}
void AvatarMixer::handleRequestDomainListDataPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode) {
auto nodeList = DependencyManager::get<NodeList>();
nodeList->getOrCreateLinkedData(senderNode);
qDebug() << "HRS FIXME received requestDomainListData packet from" << senderNode->getUUID();
if (senderNode->getLinkedData()) {
AvatarMixerClientData* nodeData = dynamic_cast<AvatarMixerClientData*>(senderNode->getLinkedData());
if (nodeData != nullptr) {
bool isRequesting;
message->readPrimitive(&isRequesting);
qDebug() << "HRS FIXME handling requestDomainListData packet" << isRequesting << "from" << nodeData->getNodeID();
nodeData->setRequestDomainListData(isRequesting);
}
}
}
void AvatarMixer::handleAvatarDataPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode) {
auto nodeList = DependencyManager::get<NodeList>();
nodeList->updateNodeWithDataFromPacket(message, senderNode);

View file

@ -42,6 +42,7 @@ private slots:
void handleKillAvatarPacket(QSharedPointer<ReceivedMessage> message);
void handleNodeIgnoreRequestPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
void handleRadiusIgnoreRequestPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);
void handleRequestDomainListDataPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
void domainSettingsRequestComplete();
void handlePacketVersionMismatch(PacketType type, const HifiSockAddr& senderSockAddr, const QUuid& senderUUID);

View file

@ -101,6 +101,8 @@ public:
void incrementAvatarOutOfView() { _recentOtherAvatarsOutOfView++; }
const QString& getBaseDisplayName() { return _baseDisplayName; }
void setBaseDisplayName(const QString& baseDisplayName) { _baseDisplayName = baseDisplayName; }
bool getRequestsDomainListData() { return _requestsDomainListData; }
void setRequestDomainListData(bool requesting) { _requestsDomainListData = requesting; }
private:
AvatarSharedPointer _avatar { new AvatarData() };
@ -129,6 +131,7 @@ private:
int _recentOtherAvatarsInView { 0 };
int _recentOtherAvatarsOutOfView { 0 };
QString _baseDisplayName{}; // The santized key used in determinging unique sessionDisplayName, so that we can remove from dictionary.
bool _requestsDomainListData { false };
};
#endif // hifi_AvatarMixerClientData_h

View file

@ -112,7 +112,7 @@ void AvatarHashMap::processAvatarDataPacket(QSharedPointer<ReceivedMessage> mess
// make sure this isn't our own avatar data or for a previously ignored node
auto nodeList = DependencyManager::get<NodeList>();
if (sessionUUID != _lastOwnerSessionUUID && !nodeList->isIgnoringNode(sessionUUID)) {
if (sessionUUID != _lastOwnerSessionUUID && (!nodeList->isIgnoringNode(sessionUUID) || nodeList->getRequestsDomainListData())) {
auto avatar = newOrExistingAvatar(sessionUUID, sendingNode);
// have the matching (or new) avatar parse the data from the packet
@ -145,7 +145,8 @@ void AvatarHashMap::processAvatarIdentityPacket(QSharedPointer<ReceivedMessage>
identity.uuid = EMPTY;
}
}
if (!nodeList->isIgnoringNode(identity.uuid)) {
qDebug() << "FIXME HRS processing identity packet regarding" << identity.uuid << "ignoring:" << nodeList->isIgnoringNode(identity.uuid) << "reqestsDomainList:" << nodeList->getRequestsDomainListData();
if (!nodeList->isIgnoringNode(identity.uuid) || nodeList->getRequestsDomainListData()) {
// mesh URL for a UUID, find avatar in our list
auto avatar = newOrExistingAvatar(identity.uuid, sendingNode);
avatar->processAvatarIdentity(identity);

View file

@ -930,3 +930,19 @@ void NodeList::processUsernameFromIDReply(QSharedPointer<ReceivedMessage> messag
emit usernameFromIDReply(nodeUUIDString, username, machineFingerprintString);
}
void NodeList::setRequestsDomainListData(bool isRequesting) {
// Tell the avatar mixer whether I want to receive any additional data to which I might be entitiled .
if (_requestsDomainListData == isRequesting) {
return;
}
eachMatchingNode([](const SharedNodePointer& node)->bool {
return node->getType() == NodeType::AvatarMixer;
}, [this, isRequesting](const SharedNodePointer& destinationNode) {
auto packet = NLPacket::create(PacketType::RequestDomainListData, sizeof(bool), true); // reliable
packet->writePrimitive(isRequesting);
sendPacket(std::move(packet), *destinationNode);
qDebug() << "HRS FIXME sending requestDomainListData packet" << isRequesting;
});
_requestsDomainListData = isRequesting;
}

View file

@ -82,6 +82,8 @@ public:
void kickNodeBySessionID(const QUuid& nodeID);
void muteNodeBySessionID(const QUuid& nodeID);
void requestUsernameFromSessionID(const QUuid& nodeID);
bool getRequestsDomainListData() { return _requestsDomainListData; }
void setRequestsDomainListData(bool isRequesting);
public slots:
void reset();
@ -153,6 +155,7 @@ private:
HifiSockAddr _assignmentServerSocket;
bool _isShuttingDown { false };
QTimer _keepAlivePingTimer;
bool _requestsDomainListData;
mutable QReadWriteLock _ignoredSetLock;
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _ignoredNodeIDs;

View file

@ -104,7 +104,8 @@ public:
UsernameFromIDRequest,
UsernameFromIDReply,
ViewFrustum,
LAST_PACKET_TYPE = ViewFrustum
RequestDomainListData,
LAST_PACKET_TYPE = ViewFrustum // FIXME! RequestDomainListData
};
};

View file

@ -61,3 +61,10 @@ void UsersScriptingInterface::disableIgnoreRadius() {
bool UsersScriptingInterface::getIgnoreRadiusEnabled() {
return DependencyManager::get<NodeList>()->getIgnoreRadiusEnabled();
}
bool UsersScriptingInterface::getRequestsDomainListData() {
return DependencyManager::get<NodeList>()->getRequestsDomainListData();
}
void UsersScriptingInterface::setRequestsDomainListData(bool isRequesting) {
DependencyManager::get<NodeList>()->setRequestsDomainListData(isRequesting);
}

View file

@ -24,6 +24,7 @@ class UsersScriptingInterface : public QObject, public Dependency {
SINGLETON_DEPENDENCY
Q_PROPERTY(bool canKick READ getCanKick)
Q_PROPERTY(bool requestsDomainListData READ getRequestsDomainListData WRITE setRequestsDomainListData)
public:
UsersScriptingInterface();
@ -105,6 +106,11 @@ signals:
* @function Users.usernameFromIDReply
*/
void usernameFromIDReply(const QString& nodeID, const QString& username, const QString& machineFingerprint);
private:
bool getRequestsDomainListData();
void setRequestsDomainListData(bool requests);
bool _requestsDomainListData;
};

View file

@ -252,9 +252,11 @@ function off() {
}
triggerMapping.disable(); // It's ok if we disable twice.
removeOverlays();
Users.requestsDomainListData = false;
}
function onClicked() {
if (!pal.visible) {
Users.requestsDomainListData = true;
populateUserList();
pal.raise();
isWired = true;