sendPacket function take Node& not a pointer

This commit is contained in:
Atlante45 2015-07-13 11:57:20 -07:00
parent 4e2cbb38bd
commit 957e6394a9
15 changed files with 33 additions and 33 deletions

View file

@ -196,7 +196,7 @@ void AssignmentClientMonitor::checkSpares() {
childNode->activateLocalSocket(); childNode->activateLocalSocket();
auto diePacket = NLPacket::create(PacketType::StopNode, 0); auto diePacket = NLPacket::create(PacketType::StopNode, 0);
nodeList->sendPacket(std::move(diePacket), childNode); nodeList->sendPacket(std::move(diePacket), *childNode);
} }
} }
} }

View file

@ -528,7 +528,7 @@ void AudioMixer::sendAudioEnvironmentPacket(SharedNodePointer node) {
envPacket->writePrimitive(reverbTime); envPacket->writePrimitive(reverbTime);
envPacket->writePrimitive(wetLevel); envPacket->writePrimitive(wetLevel);
} }
nodeList->sendPacket(std::move(envPacket), node); nodeList->sendPacket(std::move(envPacket), *node);
} }
} }
@ -555,7 +555,7 @@ void AudioMixer::readPendingDatagram(const QByteArray& receivedPacket, const Hif
nodeList->eachNode([&](const SharedNodePointer& node){ nodeList->eachNode([&](const SharedNodePointer& node){
if (node->getType() == NodeType::Agent && node->getActiveSocket() && if (node->getType() == NodeType::Agent && node->getActiveSocket() &&
node->getLinkedData() && node != sendingNode) { node->getLinkedData() && node != sendingNode) {
nodeList->sendPacket(std::move(packet), node); nodeList->sendPacket(std::move(packet), *node);
} }
}); });
} }
@ -793,7 +793,7 @@ void AudioMixer::run() {
if (nodeData->getAvatarAudioStream() if (nodeData->getAvatarAudioStream()
&& shouldMute(nodeData->getAvatarAudioStream()->getQuietestFrameLoudness())) { && shouldMute(nodeData->getAvatarAudioStream()->getQuietestFrameLoudness())) {
auto mutePacket = NLPacket::create(PacketType::NoisyMute, 0); auto mutePacket = NLPacket::create(PacketType::NoisyMute, 0);
nodeList->sendPacket(std::move(mutePacket), node); nodeList->sendPacket(std::move(mutePacket), *node);
} }
if (node->getType() == NodeType::Agent && node->getActiveSocket() if (node->getType() == NodeType::Agent && node->getActiveSocket()
@ -831,7 +831,7 @@ void AudioMixer::run() {
sendAudioEnvironmentPacket(node); sendAudioEnvironmentPacket(node);
// send mixed audio packet // send mixed audio packet
nodeList->sendPacket(std::move(mixPacket), node); nodeList->sendPacket(std::move(mixPacket), *node);
nodeData->incrementOutgoingMixedAudioSequenceNumber(); nodeData->incrementOutgoingMixedAudioSequenceNumber();
// send an audio stream stats packet if it's time // send an audio stream stats packet if it's time

View file

@ -190,7 +190,7 @@ void AudioMixerClientData::sendAudioStreamStatsPackets(const SharedNodePointer&
numStreamStatsRemaining -= numStreamStatsToPack; numStreamStatsRemaining -= numStreamStatsToPack;
// send the current packet // send the current packet
nodeList->sendPacket(std::move(statsPacket), destinationNode); nodeList->sendPacket(std::move(statsPacket), *destinationNode);
} }
} }

View file

@ -312,7 +312,7 @@ void AvatarMixer::broadcastAvatarData() {
billboardPacket->write(rfcUUID); billboardPacket->write(rfcUUID);
billboardPacket->write(billboard); billboardPacket->write(billboard);
nodeList->sendPacket(std::move(billboardPacket), node); nodeList->sendPacket(std::move(billboardPacket), *node);
++_sumBillboardPackets; ++_sumBillboardPackets;
} }
@ -330,7 +330,7 @@ void AvatarMixer::broadcastAvatarData() {
identityPacket->write(individualData); identityPacket->write(individualData);
nodeList->sendPacket(std::move(identityPacket), node); nodeList->sendPacket(std::move(identityPacket), *node);
++_sumIdentityPackets; ++_sumIdentityPackets;
} }

View file

@ -101,7 +101,7 @@ int EntityServer::sendSpecialPackets(const SharedNodePointer& node, OctreeQueryN
totalBytes += specialPacket->getSizeWithHeader(); totalBytes += specialPacket->getSizeWithHeader();
packetsSent++; packetsSent++;
DependencyManager::get<NodeList>()->sendPacket(std::move(specialPacket), node); DependencyManager::get<NodeList>()->sendPacket(std::move(specialPacket), *node);
} }
nodeData->setLastDeletedEntitiesSentAt(deletePacketSentAt); nodeData->setLastDeletedEntitiesSentAt(deletePacketSentAt);

View file

@ -179,12 +179,12 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
// actually send it // actually send it
OctreeServer::didCallWriteDatagram(this); OctreeServer::didCallWriteDatagram(this);
DependencyManager::get<NodeList>()->sendUnreliablePacket(statsPacket, _node); DependencyManager::get<NodeList>()->sendUnreliablePacket(statsPacket, *_node);
packetSent = true; packetSent = true;
} else { } else {
// not enough room in the packet, send two packets // not enough room in the packet, send two packets
OctreeServer::didCallWriteDatagram(this); OctreeServer::didCallWriteDatagram(this);
DependencyManager::get<NodeList>()->sendUnreliablePacket(statsPacket, _node); DependencyManager::get<NodeList>()->sendUnreliablePacket(statsPacket, *_node);
// since a stats message is only included on end of scene, don't consider any of these bytes "wasted", since // since a stats message is only included on end of scene, don't consider any of these bytes "wasted", since
// there was nothing else to send. // there was nothing else to send.
@ -215,7 +215,7 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
packetsSent++; packetsSent++;
OctreeServer::didCallWriteDatagram(this); OctreeServer::didCallWriteDatagram(this);
DependencyManager::get<NodeList>()->sendUnreliablePacket(nodeData->getPacket(), _node); DependencyManager::get<NodeList>()->sendUnreliablePacket(nodeData->getPacket(), *_node);
packetSent = true; packetSent = true;
int packetSizeWithHeader = nodeData->getPacket().getSizeWithHeader(); int packetSizeWithHeader = nodeData->getPacket().getSizeWithHeader();
@ -247,7 +247,7 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
if (nodeData->isPacketWaiting() && !nodeData->isShuttingDown()) { if (nodeData->isPacketWaiting() && !nodeData->isShuttingDown()) {
// just send the octree packet // just send the octree packet
OctreeServer::didCallWriteDatagram(this); OctreeServer::didCallWriteDatagram(this);
DependencyManager::get<NodeList>()->sendUnreliablePacket(nodeData->getPacket(), _node); DependencyManager::get<NodeList>()->sendUnreliablePacket(nodeData->getPacket(), *_node);
packetSent = true; packetSent = true;
int packetSizeWithHeader = nodeData->getPacket().getSizeWithHeader(); int packetSizeWithHeader = nodeData->getPacket().getSizeWithHeader();
@ -592,7 +592,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
while (nodeData->hasNextNackedPacket() && packetsSentThisInterval < maxPacketsPerInterval) { while (nodeData->hasNextNackedPacket() && packetsSentThisInterval < maxPacketsPerInterval) {
const NLPacket* packet = nodeData->getNextNackedPacket(); const NLPacket* packet = nodeData->getNextNackedPacket();
if (packet) { if (packet) {
DependencyManager::get<NodeList>()->sendUnreliablePacket(*packet, _node); DependencyManager::get<NodeList>()->sendUnreliablePacket(*packet, *_node);
truePacketsSent++; truePacketsSent++;
packetsSentThisInterval++; packetsSentThisInterval++;

View file

@ -1030,7 +1030,7 @@ void DomainServer::broadcastNewNode(const SharedNodePointer& addedNode) {
addNodePacket->write(rfcConnectionSecret); addNodePacket->write(rfcConnectionSecret);
// send off this packet to the node // send off this packet to the node
limitedNodeList->sendUnreliablePacket(*addNodePacket, node); limitedNodeList->sendUnreliablePacket(*addNodePacket, *node);
} }
); );
} }
@ -1094,7 +1094,7 @@ void DomainServer::readAvailableDatagrams() {
assignmentStream << uniqueAssignment; assignmentStream << uniqueAssignment;
limitedNodeList->sendUnreliablePacket(*assignmentPacket, senderSockAddr); limitedNodeList->sendUnreliablePacket(*assignmentPacket, *senderSockAddr);
// add the information for that deployed assignment to the hash of pending assigned nodes // add the information for that deployed assignment to the hash of pending assigned nodes
PendingAssignedNodeData* pendingNodeData = new PendingAssignedNodeData(assignmentToDeploy->getUUID(), PendingAssignedNodeData* pendingNodeData = new PendingAssignedNodeData(assignmentToDeploy->getUUID(),
@ -1125,7 +1125,7 @@ void DomainServer::readAvailableDatagrams() {
dtlsRequiredPacket->writePrimitive(dtlsPort); dtlsRequiredPacket->writePrimitive(dtlsPort);
} }
limitedNodeList->sendUnreliablePacket(*dtlsRequiredPacket, senderSockAddr); limitedNodeList->sendUnreliablePacket(*dtlsRequiredPacket, *senderSockAddr);
} }
} }
} }

View file

@ -1769,7 +1769,7 @@ void Application::sendPingPackets() {
return false; return false;
} }
}, [nodeList](const SharedNodePointer& node) { }, [nodeList](const SharedNodePointer& node) {
nodeList->sendPacket(std::move(nodeList->constructPingPacket()), node); nodeList->sendPacket(std::move(nodeList->constructPingPacket()), *node);
}); });
} }
@ -2710,7 +2710,7 @@ int Application::sendNackPackets() {
packetsSent += nackPacketList.getNumPackets(); packetsSent += nackPacketList.getNumPackets();
// send the packet list // send the packet list
nodeList->sendPacketList(nackPacketList, node); nodeList->sendPacketList(nackPacketList, *node);
} }
} }
}); });
@ -2891,7 +2891,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType::Value packetTyp
queryPacket->setSizeUsed(packetSize); queryPacket->setSizeUsed(packetSize);
// make sure we still have an active socket // make sure we still have an active socket
nodeList->sendUnreliablePacket(*queryPacket, node); nodeList->sendUnreliablePacket(*queryPacket, *node);
} }
}); });
} }

View file

@ -882,7 +882,7 @@ void AudioClient::handleAudioInput() {
nodeList->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::SendAudioPacket); nodeList->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::SendAudioPacket);
nodeList->sendUnreliablePacket(*_audioPacket, audioMixer); nodeList->sendUnreliablePacket(*_audioPacket, *audioMixer);
_outgoingAvatarAudioSequenceNumber++; _outgoingAvatarAudioSequenceNumber++;
} }
@ -924,7 +924,7 @@ void AudioClient::sendMuteEnvironmentPacket() {
if (audioMixer) { if (audioMixer) {
// send off this mute packet // send off this mute packet
nodeList->sendPacket(std::move(mutePacket), audioMixer); nodeList->sendPacket(std::move(mutePacket), *audioMixer);
} }
} }

View file

@ -124,5 +124,5 @@ void AudioIOStats::sendDownstreamAudioStatsPacket() {
// send packet // send packet
SharedNodePointer audioMixer = nodeList->soloNodeOfType(NodeType::AudioMixer); SharedNodePointer audioMixer = nodeList->soloNodeOfType(NodeType::AudioMixer);
nodeList->sendPacket(std::move(statsPacket), audioMixer); nodeList->sendPacket(std::move(statsPacket), *audioMixer);
} }

View file

@ -238,7 +238,7 @@ void AudioInjector::injectToMixer() {
SharedNodePointer audioMixer = nodeList->soloNodeOfType(NodeType::AudioMixer); SharedNodePointer audioMixer = nodeList->soloNodeOfType(NodeType::AudioMixer);
// send off this audio packet // send off this audio packet
nodeList->sendUnreliablePacket(*audioPacket, audioMixer); nodeList->sendUnreliablePacket(*audioPacket, *audioMixer);
outgoingInjectedAudioSequenceNumber++; outgoingInjectedAudioSequenceNumber++;
_currentSendPosition += bytesToCopy; _currentSendPosition += bytesToCopy;

View file

@ -123,14 +123,14 @@ public:
qint64 readDatagram(QByteArray& incomingPacket, QHostAddress* address, quint16 * port); qint64 readDatagram(QByteArray& incomingPacket, QHostAddress* address, quint16 * port);
qint64 sendUnreliablePacket(const NLPacket& packet, const SharedNodePointer& destinationNode) { assert(false); return 0; } qint64 sendUnreliablePacket(const NLPacket& packet, const Node& destinationNode);
qint64 sendUnreliablePacket(const NLPacket& packet, const HifiSockAddr& sockAddr) { assert(false); return 0; } qint64 sendUnreliablePacket(const NLPacket& packet, const HifiSockAddr& sockAddr);
qint64 sendPacket(std::unique_ptr<NLPacket> packet, const SharedNodePointer& destinationNode) { assert(false); return 0; } qint64 sendPacket(std::unique_ptr<NLPacket> packet, const Node& destinationNode);
qint64 sendPacket(std::unique_ptr<NLPacket> packet, const HifiSockAddr& sockAddr) { assert(false); return 0; } qint64 sendPacket(std::unique_ptr<NLPacket> packet, const HifiSockAddr& sockAddr);
qint64 sendPacketList(NLPacketList& packetList, const SharedNodePointer& destinationNode) { assert(false); return 0; } qint64 sendPacketList(NLPacketList& packetList, const Node& destinationNode);
qint64 sendPacketList(NLPacketList& packetList, const HifiSockAddr& sockAddr) { assert(false); return 0; } qint64 sendPacketList(NLPacketList& packetList, const HifiSockAddr& sockAddr);
void (*linkedDataCreateCallback)(Node *); void (*linkedDataCreateCallback)(Node *);

View file

@ -272,7 +272,7 @@ bool PacketSender::nonThreadedProcess() {
unlock(); unlock();
// send the packet through the NodeList... // send the packet through the NodeList...
DependencyManager::get<NodeList>()->sendUnreliablePacket(*(packetPair.second), packetPair.first); DependencyManager::get<NodeList>()->sendUnreliablePacket(*packetPair.second, *packetPair.first);
packetsSentThisCall++; packetsSentThisCall++;
_packetsOverCheckInterval++; _packetsOverCheckInterval++;

View file

@ -219,7 +219,7 @@ void OctreeHeadlessViewer::queryOctree() {
_octreeQuery.getBroadcastData(reinterpret_cast<unsigned char*>(queryPacket->getPayload())); _octreeQuery.getBroadcastData(reinterpret_cast<unsigned char*>(queryPacket->getPayload()));
// ask the NodeList to send it // ask the NodeList to send it
nodeList->sendPacket(std::move(queryPacket), node); nodeList->sendPacket(std::move(queryPacket), *node);
} }
}); });
} }

View file

@ -675,7 +675,7 @@ void ScriptEngine::run() {
audioPacket->writePrimitive(sequence); audioPacket->writePrimitive(sequence);
// send audio packet // send audio packet
nodeList->sendUnreliablePacket(*audioPacket, node); nodeList->sendUnreliablePacket(*audioPacket, *node);
} }
}); });
} }