Merge branch 'master' of github.com:highfidelity/hifi into commerce_upgrades_1

This commit is contained in:
Zach Fox 2018-03-14 09:54:16 -07:00
commit 6d45d69ed8
5 changed files with 27 additions and 14 deletions

View file

@ -42,7 +42,7 @@ AvatarMixer::AvatarMixer(ReceivedMessage& message) :
ThreadedAssignment(message) ThreadedAssignment(message)
{ {
// make sure we hear about node kills so we can tell the other nodes // make sure we hear about node kills so we can tell the other nodes
connect(DependencyManager::get<NodeList>().data(), &NodeList::nodeKilled, this, &AvatarMixer::nodeKilled); connect(DependencyManager::get<NodeList>().data(), &NodeList::nodeKilled, this, &AvatarMixer::handleAvatarKilled);
auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver(); auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
packetReceiver.registerListener(PacketType::AvatarData, this, "queueIncomingPacket"); packetReceiver.registerListener(PacketType::AvatarData, this, "queueIncomingPacket");
@ -423,14 +423,15 @@ void AvatarMixer::throttle(std::chrono::microseconds duration, int frame) {
} }
} }
void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
if (killedNode->getType() == NodeType::Agent void AvatarMixer::handleAvatarKilled(SharedNodePointer avatarNode) {
&& killedNode->getLinkedData()) { if (avatarNode->getType() == NodeType::Agent
&& avatarNode->getLinkedData()) {
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
{ // decrement sessionDisplayNames table and possibly remove { // decrement sessionDisplayNames table and possibly remove
QMutexLocker nodeDataLocker(&killedNode->getLinkedData()->getMutex()); QMutexLocker nodeDataLocker(&avatarNode->getLinkedData()->getMutex());
AvatarMixerClientData* nodeData = dynamic_cast<AvatarMixerClientData*>(killedNode->getLinkedData()); AvatarMixerClientData* nodeData = dynamic_cast<AvatarMixerClientData*>(avatarNode->getLinkedData());
const QString& baseDisplayName = nodeData->getBaseDisplayName(); const QString& baseDisplayName = nodeData->getBaseDisplayName();
// No sense guarding against very rare case of a node with no entry, as this will work without the guard and do one less lookup in the common case. // No sense guarding against very rare case of a node with no entry, as this will work without the guard and do one less lookup in the common case.
if (--_sessionDisplayNames[baseDisplayName].second <= 0) { if (--_sessionDisplayNames[baseDisplayName].second <= 0) {
@ -447,12 +448,12 @@ void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
// we relay avatar kill packets to agents that are not upstream // we relay avatar kill packets to agents that are not upstream
// and downstream avatar mixers, if the node that was just killed was being replicated // and downstream avatar mixers, if the node that was just killed was being replicated
return (node->getType() == NodeType::Agent && !node->isUpstream()) || return (node->getType() == NodeType::Agent && !node->isUpstream()) ||
(killedNode->isReplicated() && shouldReplicateTo(*killedNode, *node)); (avatarNode->isReplicated() && shouldReplicateTo(*avatarNode, *node));
}, [&](const SharedNodePointer& node) { }, [&](const SharedNodePointer& node) {
if (node->getType() == NodeType::Agent) { if (node->getType() == NodeType::Agent) {
if (!killPacket) { if (!killPacket) {
killPacket = NLPacket::create(PacketType::KillAvatar, NUM_BYTES_RFC4122_UUID + sizeof(KillAvatarReason)); killPacket = NLPacket::create(PacketType::KillAvatar, NUM_BYTES_RFC4122_UUID + sizeof(KillAvatarReason));
killPacket->write(killedNode->getUUID().toRfc4122()); killPacket->write(avatarNode->getUUID().toRfc4122());
killPacket->writePrimitive(KillAvatarReason::AvatarDisconnected); killPacket->writePrimitive(KillAvatarReason::AvatarDisconnected);
} }
@ -462,7 +463,7 @@ void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
if (!replicatedKillPacket) { if (!replicatedKillPacket) {
replicatedKillPacket = NLPacket::create(PacketType::ReplicatedKillAvatar, replicatedKillPacket = NLPacket::create(PacketType::ReplicatedKillAvatar,
NUM_BYTES_RFC4122_UUID + sizeof(KillAvatarReason)); NUM_BYTES_RFC4122_UUID + sizeof(KillAvatarReason));
replicatedKillPacket->write(killedNode->getUUID().toRfc4122()); replicatedKillPacket->write(avatarNode->getUUID().toRfc4122());
replicatedKillPacket->writePrimitive(KillAvatarReason::AvatarDisconnected); replicatedKillPacket->writePrimitive(KillAvatarReason::AvatarDisconnected);
} }
@ -479,7 +480,7 @@ void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
return false; return false;
} }
if (node->getUUID() == killedNode->getUUID()) { if (node->getUUID() == avatarNode->getUUID()) {
return false; return false;
} }
@ -489,7 +490,7 @@ void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
QMetaObject::invokeMethod(node->getLinkedData(), QMetaObject::invokeMethod(node->getLinkedData(),
"cleanupKilledNode", "cleanupKilledNode",
Qt::AutoConnection, Qt::AutoConnection,
Q_ARG(const QUuid&, QUuid(killedNode->getUUID()))); Q_ARG(const QUuid&, QUuid(avatarNode->getUUID())));
} }
); );
} }
@ -605,7 +606,9 @@ void AvatarMixer::handleAvatarIdentityPacket(QSharedPointer<ReceivedMessage> mes
void AvatarMixer::handleKillAvatarPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer node) { void AvatarMixer::handleKillAvatarPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer node) {
auto start = usecTimestampNow(); auto start = usecTimestampNow();
DependencyManager::get<NodeList>()->processKillNode(*message); handleAvatarKilled(node);
node->setLinkedData(nullptr);
auto end = usecTimestampNow(); auto end = usecTimestampNow();
_handleKillAvatarPacketElapsedTime += (end - start); _handleKillAvatarPacketElapsedTime += (end - start);

View file

@ -39,7 +39,7 @@ public slots:
/// runs the avatar mixer /// runs the avatar mixer
void run() override; void run() override;
void nodeKilled(SharedNodePointer killedNode); void handleAvatarKilled(SharedNodePointer killedNode);
void sendStatsPacket() override; void sendStatsPacket() override;

View file

@ -576,7 +576,7 @@ void Connection::processControl(ControlPacketPointer controlPacket) {
// where the other end expired our connection. Let's reset. // where the other end expired our connection. Let's reset.
#ifdef UDT_CONNECTION_DEBUG #ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "Got handshake request, stopping SendQueue"; qCDebug(networking) << "Got HandshakeRequest from" << _destination << ", stopping SendQueue";
#endif #endif
_hasReceivedHandshakeACK = false; _hasReceivedHandshakeACK = false;
stopSendQueue(); stopSendQueue();

View file

@ -402,6 +402,10 @@ void Socket::readPendingDatagrams() {
packet->getDataSize(), packet->getDataSize(),
packet->getPayloadSize())) { packet->getPayloadSize())) {
// the connection could not be created or indicated that we should not continue processing this packet // the connection could not be created or indicated that we should not continue processing this packet
#ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "Can't process packet: version" << (unsigned int)NLPacket::versionInHeader(*packet)
<< ", type" << NLPacket::typeInHeader(*packet);
#endif
continue; continue;
} }
} }

View file

@ -98,6 +98,12 @@ void CompositeHUD::run(const RenderContextPointer& renderContext) {
// Grab the HUD texture // Grab the HUD texture
#if !defined(DISABLE_QML) #if !defined(DISABLE_QML)
gpu::doInBatch("CompositeHUD", renderContext->args->_context, [&](gpu::Batch& batch) { gpu::doInBatch("CompositeHUD", renderContext->args->_context, [&](gpu::Batch& batch) {
glm::mat4 projMat;
Transform viewMat;
renderContext->args->getViewFrustum().evalProjectionMatrix(projMat);
renderContext->args->getViewFrustum().evalViewTransform(viewMat);
batch.setProjectionTransform(projMat);
batch.setViewTransform(viewMat, true);
if (renderContext->args->_hudOperator) { if (renderContext->args->_hudOperator) {
renderContext->args->_hudOperator(batch, renderContext->args->_hudTexture, renderContext->args->_renderMode == RenderArgs::RenderMode::MIRROR_RENDER_MODE); renderContext->args->_hudOperator(batch, renderContext->args->_hudTexture, renderContext->args->_renderMode == RenderArgs::RenderMode::MIRROR_RENDER_MODE);
} }