resolve conflicts on merge with huffman/receive_packets

This commit is contained in:
Stephen Birarda 2015-07-10 16:47:27 -07:00
commit 4442bb55d6
19 changed files with 172 additions and 147 deletions

View file

@ -47,6 +47,10 @@ Agent::Agent(const QByteArray& packet) :
DependencyManager::set<ResourceCacheSharedItems>();
DependencyManager::set<SoundCache>();
auto& packetReceiver = DependencyManager::get<NodeList>()->getPackingReceiver();
packetReceiver.registerPacketListener(PacketType::MixedAudio, this, "handleAudioPacket");
packetReceiver.registerPacketListener(PacketType::SilentAudioFrame, this, "handleAudioPacket");
}
void Agent::readPendingDatagrams() {
@ -106,35 +110,19 @@ void Agent::readPendingDatagrams() {
if (datagramPacketType == PacketType::EntityData || datagramPacketType == PacketType::EntityErase) {
_entityViewer.processDatagram(mutablePacket, sourceNode);
}
} else if (datagramPacketType == PacketType::MixedAudio || datagramPacketType == PacketType::SilentAudioFrame) {
_receivedAudioStream.parseData(receivedPacket);
_lastReceivedAudioLoudness = _receivedAudioStream.getNextOutputFrameLoudness();
_receivedAudioStream.clearBuffer();
// let this continue through to the NodeList so it updates last heard timestamp
// for the sending audio mixer
DependencyManager::get<NodeList>()->processNodeData(senderSockAddr, receivedPacket);
} else if (datagramPacketType == PacketType::BulkAvatarData
|| datagramPacketType == PacketType::AvatarIdentity
|| datagramPacketType == PacketType::AvatarBillboard
|| datagramPacketType == PacketType::KillAvatar) {
// let the avatar hash map process it
DependencyManager::get<AvatarHashMap>()->processAvatarMixerDatagram(receivedPacket, nodeList->sendingNodeForPacket(receivedPacket));
// let this continue through to the NodeList so it updates last heard timestamp
// for the sending avatar-mixer
DependencyManager::get<NodeList>()->processNodeData(senderSockAddr, receivedPacket);
} else {
DependencyManager::get<NodeList>()->processNodeData(senderSockAddr, receivedPacket);
}
}
}
}
void Agent::handleAudioPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr) {
_receivedAudioStream.parseData(receivedPacket);
_lastReceivedAudioLoudness = _receivedAudioStream.getNextOutputFrameLoudness();
_receivedAudioStream.clearBuffer();
}
const QString AGENT_LOGGING_NAME = "agent";
void Agent::run() {

View file

@ -55,6 +55,9 @@ public slots:
void readPendingDatagrams();
void playAvatarSound(Sound* avatarSound) { _scriptEngine.setAvatarSound(avatarSound); }
private slots:
void handleAudioPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr);
private:
ScriptEngine _scriptEngine;
EntityEditPacketSender _entityEditSender;

View file

@ -104,9 +104,6 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
connect(&_requestTimer, SIGNAL(timeout()), SLOT(sendAssignmentRequest()));
_requestTimer.start(ASSIGNMENT_REQUEST_INTERVAL_MSECS);
// connect our readPendingDatagrams method to the readyRead() signal of the socket
connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, this, &AssignmentClient::readPendingDatagrams);
// connections to AccountManager for authentication
connect(&AccountManager::getInstance(), &AccountManager::authRequired,
this, &AssignmentClient::handleAuthenticationRequest);
@ -123,6 +120,9 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
// Hook up a timer to send this child's status to the Monitor once per second
setUpStatsToMonitor();
}
auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
packetReceiver.registerPacketListener(PacketType::CreateAssignment, this, "handleCreateAssignmentPacket");
packetReceiver.registerPacketListener(PacketType::CreateAssignment, this, "handleStopNodePacket");
}
@ -206,85 +206,65 @@ void AssignmentClient::sendAssignmentRequest() {
}
}
void AssignmentClient::readPendingDatagrams() {
auto nodeList = DependencyManager::get<NodeList>();
void AssignmentClient::handleCreateAssignmentPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr) {
qDebug() << "Received a PacketType::CreateAssignment - attempting to unpack.";
QByteArray receivedPacket;
HifiSockAddr senderSockAddr;
// construct the deployed assignment from the packet data
_currentAssignment = AssignmentFactory::unpackAssignment(QByteArray::fromRawData(packet->getData(), packet->getSizeWithHeader()));
while (nodeList->getNodeSocket().hasPendingDatagrams()) {
receivedPacket.resize(nodeList->getNodeSocket().pendingDatagramSize());
nodeList->getNodeSocket().readDatagram(receivedPacket.data(), receivedPacket.size(),
senderSockAddr.getAddressPointer(), senderSockAddr.getPortPointer());
if (_currentAssignment) {
qDebug() << "Received an assignment -" << *_currentAssignment;
if (nodeList->packetVersionAndHashMatch(receivedPacket)) {
if (packetTypeForPacket(receivedPacket) == PacketType::CreateAssignment) {
auto nodeList = DependencyManager::get<NodeList>();
qDebug() << "Received a PacketType::CreateAssignment - attempting to unpack.";
// switch our DomainHandler hostname and port to whoever sent us the assignment
// construct the deployed assignment from the packet data
_currentAssignment = AssignmentFactory::unpackAssignment(receivedPacket);
nodeList->getDomainHandler().setSockAddr(senderSockAddr, _assignmentServerHostname);
nodeList->getDomainHandler().setAssignmentUUID(_currentAssignment->getUUID());
if (_currentAssignment) {
qDebug() << "Received an assignment -" << *_currentAssignment;
qDebug() << "Destination IP for assignment is" << nodeList->getDomainHandler().getIP().toString();
// switch our DomainHandler hostname and port to whoever sent us the assignment
// start the deployed assignment
QThread* workerThread = new QThread;
workerThread->setObjectName("ThreadedAssignment Worker");
nodeList->getDomainHandler().setSockAddr(senderSockAddr, _assignmentServerHostname);
nodeList->getDomainHandler().setAssignmentUUID(_currentAssignment->getUUID());
connect(workerThread, &QThread::started, _currentAssignment.data(), &ThreadedAssignment::run);
qDebug() << "Destination IP for assignment is" << nodeList->getDomainHandler().getIP().toString();
// Once the ThreadedAssignment says it is finished - we ask it to deleteLater
// This is a queued connection so that it is put into the event loop to be processed by the worker
// thread when it is ready.
connect(_currentAssignment.data(), &ThreadedAssignment::finished, _currentAssignment.data(),
&ThreadedAssignment::deleteLater, Qt::QueuedConnection);
// start the deployed assignment
QThread* workerThread = new QThread;
workerThread->setObjectName("ThreadedAssignment Worker");
// once it is deleted, we quit the worker thread
connect(_currentAssignment.data(), &ThreadedAssignment::destroyed, workerThread, &QThread::quit);
connect(workerThread, &QThread::started, _currentAssignment.data(), &ThreadedAssignment::run);
// have the worker thread remove itself once it is done
connect(workerThread, &QThread::finished, workerThread, &QThread::deleteLater);
// Once the ThreadedAssignment says it is finished - we ask it to deleteLater
// This is a queued connection so that it is put into the event loop to be processed by the worker
// thread when it is ready.
connect(_currentAssignment.data(), &ThreadedAssignment::finished, _currentAssignment.data(),
&ThreadedAssignment::deleteLater, Qt::QueuedConnection);
// once the worker thread says it is done, we consider the assignment completed
connect(workerThread, &QThread::destroyed, this, &AssignmentClient::assignmentCompleted);
// once it is deleted, we quit the worker thread
connect(_currentAssignment.data(), &ThreadedAssignment::destroyed, workerThread, &QThread::quit);
_currentAssignment->moveToThread(workerThread);
// have the worker thread remove itself once it is done
connect(workerThread, &QThread::finished, workerThread, &QThread::deleteLater);
// move the NodeList to the thread used for the _current assignment
nodeList->moveToThread(workerThread);
// once the worker thread says it is done, we consider the assignment completed
connect(workerThread, &QThread::destroyed, this, &AssignmentClient::assignmentCompleted);
// Starts an event loop, and emits workerThread->started()
workerThread->start();
} else {
qDebug() << "Received an assignment that could not be unpacked. Re-requesting.";
}
}
_currentAssignment->moveToThread(workerThread);
void AssignmentClient::handleStopNodePacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr) {
if (senderSockAddr.getAddress() == QHostAddress::LocalHost ||
senderSockAddr.getAddress() == QHostAddress::LocalHostIPv6) {
qDebug() << "AssignmentClientMonitor at" << senderSockAddr << "requested stop via PacketType::StopNode.";
// move the NodeList to the thread used for the _current assignment
nodeList->moveToThread(workerThread);
// let the assignment handle the incoming datagrams for its duration
disconnect(&nodeList->getNodeSocket(), 0, this, 0);
connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, _currentAssignment.data(),
&ThreadedAssignment::readPendingDatagrams);
// Starts an event loop, and emits workerThread->started()
workerThread->start();
} else {
qDebug() << "Received an assignment that could not be unpacked. Re-requesting.";
}
} else if (packetTypeForPacket(receivedPacket) == PacketType::StopNode) {
if (senderSockAddr.getAddress() == QHostAddress::LocalHost ||
senderSockAddr.getAddress() == QHostAddress::LocalHostIPv6) {
qDebug() << "AssignmentClientMonitor at" << senderSockAddr << "requested stop via PacketType::StopNode.";
QCoreApplication::quit();
} else {
qDebug() << "Got a stop packet from other than localhost.";
}
} else {
// have the NodeList attempt to handle it
nodeList->processNodeData(senderSockAddr, receivedPacket);
}
}
QCoreApplication::quit();
} else {
qDebug() << "Got a stop packet from other than localhost.";
}
}
@ -327,9 +307,6 @@ void AssignmentClient::assignmentCompleted() {
auto nodeList = DependencyManager::get<NodeList>();
// have us handle incoming NodeList datagrams again, and make sure our ThreadedAssignment isn't handling them
connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, this, &AssignmentClient::readPendingDatagrams);
// reset our NodeList by switching back to unassigned and clearing the list
nodeList->setOwnerType(NodeType::Unassigned);
nodeList->reset();

View file

@ -28,7 +28,6 @@ public:
quint16 assignmentMonitorPort);
private slots:
void sendAssignmentRequest();
void readPendingDatagrams();
void assignmentCompleted();
void handleAuthenticationRequest();
void sendStatsPacketToACM();
@ -37,6 +36,10 @@ private slots:
public slots:
void aboutToQuit();
private slots:
void handleCreateAssignmentPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr);
void handleStopNodePacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr);
private:
void setUpStatsToMonitor();

View file

@ -96,13 +96,13 @@ AudioMixer::AudioMixer(const QByteArray& packet) :
// we will soon find a better common home for these audio-related constants
// SOON
auto nodeList = DependencyManager::get<NodeList>();
nodeList->registerPacketListener(PacketType::MicrophoneAudioNoEcho, this, "handleMicrophoneAudioNoEchoPacket");
nodeList->registerPacketListener(PacketType::MicrophoneAudioWithEcho, this, "handleMicrophoneAudioWithEchoPacket");
nodeList->registerPacketListener(PacketType::InjectAudio, this, "handleInjectAudioPacket");
nodeList->registerPacketListener(PacketType::SilentAudioFrame, this, "handleSilentAudioFramePacket");
nodeList->registerPacketListener(PacketType::AudioStreamStats, this, "handleAudioStreamStatsPacket");
nodeList->registerPacketListener(PacketType::MuteEnvironment, this, "handleMuteEnvironmentPacket");
auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
packetReceiver.registerPacketListener(PacketType::MicrophoneAudioNoEcho, this, "handleMicrophoneAudioNoEchoPacket");
packetReceiver.registerPacketListener(PacketType::MicrophoneAudioWithEcho, this, "handleMicrophoneAudioWithEchoPacket");
packetReceiver.registerPacketListener(PacketType::InjectAudio, this, "handleInjectAudioPacket");
packetReceiver.registerPacketListener(PacketType::SilentAudioFrame, this, "handleSilentAudioFramePacket");
packetReceiver.registerPacketListener(PacketType::AudioStreamStats, this, "handleAudioStreamStatsPacket");
packetReceiver.registerPacketListener(PacketType::MuteEnvironment, this, "handleMuteEnvironmentPacket");
}
const float ATTENUATION_BEGINS_AT_DISTANCE = 1.0f;

View file

@ -35,7 +35,6 @@ public slots:
/// threaded run of assignment
void run();
void readPendingDatagrams() { }; // this will not be called since our datagram processing thread will handle
void readPendingDatagram(const QByteArray& receivedPacket, const HifiSockAddr& senderSockAddr);
void sendStatsPacket();

View file

@ -23,7 +23,11 @@ const char* LOCAL_MODELS_PERSIST_FILE = "resources/models.svo";
EntityServer::EntityServer(const QByteArray& packet)
: OctreeServer(packet), _entitySimulation(NULL) {
// nothing special to do here...
auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
packetReceiver.registerPacketListener(PacketType::EntityAdd, this, "handleEntityAddPacket");
packetReceiver.registerPacketListener(PacketType::EntityEdit, this, "handleEntityEditPacket");
packetReceiver.registerPacketListener(PacketType::EntityErase, this, "handleEntityErasePacket");
}
EntityServer::~EntityServer() {
@ -36,6 +40,24 @@ EntityServer::~EntityServer() {
tree->removeNewlyCreatedHook(this);
}
void EntityServer::handleEntityAddPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr) {
if (_octreeInboundPacketProcessor) {
_octreeInboundPacketProcessor->queueReceivedPacket(senderNode, receivedPacket->getData());
}
}
void EntityServer::handleEntityEditPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr) {
if (_octreeInboundPacketProcessor) {
_octreeInboundPacketProcessor->queueReceivedPacket(senderNode, receivedPacket->getData());
}
}
void EntityServer::handleEntityErasePacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr) {
if (_octreeInboundPacketProcessor) {
_octreeInboundPacketProcessor->queueReceivedPacket(senderNode, receivedPacket->getData());
}
}
OctreeQueryNode* EntityServer::createOctreeQueryNode() {
return new EntityNodeData();
}

View file

@ -49,6 +49,11 @@ public slots:
protected:
virtual Octree* createTree();
private slots:
void handleEntityAddPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr);
void handleEntityEditPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr);
void handleEntityErasePacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr);
private:
EntitySimulation* _entitySimulation;
QTimer* _pruneDeletedEntitiesTimer = nullptr;

View file

@ -247,6 +247,11 @@ OctreeServer::OctreeServer(const QByteArray& packet) :
// make sure the AccountManager has an Auth URL for payment redemptions
AccountManager::getInstance().setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL);
auto packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
packetReceiver->registerPacketListener(getMyQueryMessageType(), this, "handleOctreeQueryPacket");
packetReceiver->registerPacketListener(PacketType::OctreeDataNack, this, "handleOctreeDataNackPacket");
packetReceiver->registerPacketListener(PacketType::JurisdictionRequest, this, "handleJurisdictionRequestPacket");
}
OctreeServer::~OctreeServer() {
@ -855,6 +860,37 @@ void OctreeServer::readPendingDatagram(const QByteArray& receivedPacket, const H
}
}
void handleOctreeQueryPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr) {
// If we got a query packet, then we're talking to an agent, and we
// need to make sure we have it in our nodeList.
SharedNodePointer matchingNode = nodeList->nodeWithUUID(packet->getSourceID());
if (matchingNode) {
nodeList->updateNodeWithDataFromPacket(matchingNode, packet->getData());
OctreeQueryNode* nodeData = (OctreeQueryNode*) matchingNode->getLinkedData();
if (nodeData && !nodeData->isOctreeSendThreadInitalized()) {
nodeData->initializeOctreeSendThread(this, matchingNode);
}
}
}
void handleOctreeDataNackPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr) {
// If we got a nack packet, then we're talking to an agent, and we
// need to make sure we have it in our nodeList.
SharedNodePointer matchingNode = nodeList->nodeWithUUID(packet->getSourceID());
if (matchingNode) {
OctreeQueryNode* nodeData = (OctreeQueryNode*)matchingNode->getLinkedData();
if (nodeData) {
nodeData->parseNackPacket(packet->getData());
}
}
}
void handleJurisdictionRequestPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr) {
SharedNodePointer matchingNode = nodeList->nodeWithUUID(packet->getSourceID());
_jurisdictionSender->queueReceivedPacket(matchingNode, packet->getData());
}
void OctreeServer::setupDatagramProcessingThread() {
auto nodeList = DependencyManager::get<NodeList>();

View file

@ -128,6 +128,11 @@ public slots:
void readPendingDatagrams() { }; // this will not be called since our datagram processing thread will handle
void readPendingDatagram(const QByteArray& receivedPacket, const HifiSockAddr& senderSockAddr);
private slots:
void handleOctreeQueryPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr);
void handleOctreeDataNackPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr);
void handleJurisdictionRequestPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr);
protected:
virtual Octree* createTree() = 0;
bool readOptionBool(const QString& optionName, const QJsonObject& settingsSectionObject, bool& result);

View file

@ -3822,19 +3822,19 @@ void Application::domainConnectionDenied(const QString& reason) {
}
}
void handleDomainConnectionDeniedPacket(std::unique_ptr<NLPacket>, HifiSockAddr senderSockAddr) {
int headerSize = numBytesForPacketHeaderGivenPacketType(PacketType::DomainConnectionDenied);
QDataStream packetStream(QByteArray(incomingPacket.constData() + headerSize,
incomingPacket.size() - headerSize));
QString reason;
packetStream >> reason;
void Application::handleDomainConnectionDeniedPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr) {
int headerSize = numBytesForPacketHeaderGivenPacketType(PacketType::DomainConnectionDenied);
QDataStream packetStream(QByteArray::fromRawData(packet->getData(), packet->getSizeWithHeader()));
// output to the log so the user knows they got a denied connection request
// and check and signal for an access token so that we can make sure they are logged in
qCDebug(interfaceapp) << "The domain-server denied a connection request: " << reason;
qCDebug(interfaceapp) << "You may need to re-log to generate a keypair so you can provide a username signature.";
domainConnectionDenied(reason);
AccountManager::getInstance().checkAndSignalForAccessToken();
QString reason;
packetStream >> reason;
// output to the log so the user knows they got a denied connection request
// and check and signal for an access token so that we can make sure they are logged in
qCDebug(interfaceapp) << "The domain-server denied a connection request: " << reason;
qCDebug(interfaceapp) << "You may need to re-log to generate a keypair so you can provide a username signature.";
domainConnectionDenied(reason);
AccountManager::getInstance().checkAndSignalForAccessToken();
}
void Application::connectedToDomain(const QString& hostname) {

View file

@ -444,7 +444,7 @@ public slots:
void notifyPacketVersionMismatch();
void domainConnectionDenied(const QString& reason);
void handleDomainConnectionDeniedPacket(std::unique_ptr<NLPacket>, HifiSockAddr senderSockAddr);
void handleDomainConnectionDeniedPacket(QSharedPointer<NLPacket>, SharedNodePointer senderNode, HifiSockAddr senderSockAddr);
void cameraMenuChanged();

View file

@ -26,32 +26,20 @@ OctreePacketProcessor::OctreePacketProcessor() {
}
// TODO implement packet processing in PacketType-specific methods
void OctreePacketProcessor::handleEntityDataPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr) {
SharedNodePointer sendingNode = DependencyManager::get<NodeList>()->nodeWithUUID(packet->getSourceID());
if (sendingNode) {
processPacket(sendingNode, QByteArray::fromRawData(packet->getData(), packet->getSizeWithHeader()));
}
void OctreePacketProcessor::handleEntityDataPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr) {
queueReceivedPacket(senderNode, QByteArray::fromRawData(packet->getData(), packet->getSizeWithHeader()));
}
void OctreePacketProcessor::handleEntityErasePacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr) {
SharedNodePointer sendingNode = DependencyManager::get<NodeList>()->nodeWithUUID(packet->getSourceID());
if (sendingNode) {
processPacket(sendingNode, QByteArray::fromRawData(packet->getData(), packet->getSizeWithHeader()));
}
void OctreePacketProcessor::handleEntityErasePacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr) {
queueReceivedPacket(senderNode, QByteArray::fromRawData(packet->getData(), packet->getSizeWithHeader()));
}
void OctreePacketProcessor::handleOctreeStatsPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr) {
SharedNodePointer sendingNode = DependencyManager::get<NodeList>()->nodeWithUUID(packet->getSourceID());
if (sendingNode) {
processPacket(sendingNode, QByteArray::fromRawData(packet->getData(), packet->getSizeWithHeader()));
}
void OctreePacketProcessor::handleOctreeStatsPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr) {
queueReceivedPacket(senderNode, QByteArray::fromRawData(packet->getData(), packet->getSizeWithHeader()));
}
void OctreePacketProcessor::handleEnvironmentDataPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr) {
SharedNodePointer sendingNode = DependencyManager::get<NodeList>()->nodeWithUUID(packet->getSourceID());
if (sendingNode) {
processPacket(sendingNode, QByteArray::fromRawData(packet->getData(), packet->getSizeWithHeader()));
}
void OctreePacketProcessor::handleEnvironmentDataPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr) {
queueReceivedPacket(senderNode, QByteArray::fromRawData(packet->getData(), packet->getSizeWithHeader()));
}
void OctreePacketProcessor::processPacket(const SharedNodePointer& sendingNode, const QByteArray& packet) {

View file

@ -16,13 +16,11 @@
/// Handles processing of incoming voxel packets for the interface application. As with other ReceivedPacketProcessor classes
/// the user is responsible for reading inbound packets and adding them to the processing queue by calling queueReceivedPacket()
class OctreePacketProcessor : public GenericThread {
class OctreePacketProcessor : public ReceivedPacketProcessor {
Q_OBJECT
public:
OctreePacketProcessor();
virtual bool process() override { };
signals:
void packetVersionMismatch();
@ -30,9 +28,9 @@ protected:
virtual void processPacket(const SharedNodePointer& sendingNode, const QByteArray& packet);
private slots:
void handleEntityDataPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr);
void handleEntityErasePacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr);
void handleOctreeStatsPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr);
void handleEnvironmentDataPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr);
void handleEntityDataPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr);
void handleEntityErasePacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr);
void handleOctreeStatsPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr);
void handleEnvironmentDataPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode, HifiSockAddr senderSockAddr);
};
#endif // hifi_OctreePacketProcessor_h

View file

@ -85,7 +85,7 @@ void AvatarHashMap::processAvatarDataPacket(QSharedPointer<NLPacket> packet, Hif
void AvatarHashMap::processAvatarIdentityPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr) {
// setup a data stream to parse the packet
QDataStream identityStream { packet.get() };
QDataStream identityStream { packet.data() };
QUuid sessionUUID;

View file

@ -34,7 +34,6 @@ public:
int size() { return _avatarHash.size(); }
public slots:
void processAvatarMixerDatagram(const QByteArray& datagram, const QWeakPointer<Node>& mixerWeakPointer);
bool isAvatarInRange(const glm::vec3 & position, const float range);
private slots:

View file

@ -23,9 +23,9 @@ EntityEditPacketSender::EntityEditPacketSender() {
}
void EntityEditPacketSender::processEntityEditNackPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr) {
if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableNackPackets)) {
// if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableNackPackets)) {
processNackPacket(QByteArray::fromRawData(packet->getData(), packet->getSizeWithHeader()));
}
// }
}
void EntityEditPacketSender::adjustEditPacketForClockSkew(PacketType::Value type, QByteArray& buffer, int clockSkew) {

View file

@ -25,6 +25,9 @@ class PacketReceiver : public QObject {
Q_OBJECT
public:
PacketReceiver(QObject* parent = 0);
PacketReceiver(const PacketReceiver&) = delete;
PacketReceiver& operator=(const PacketReceiver&) = delete;
int getInPacketCount() const { return _inPacketCount; }
int getOutPacketCount() const { return _outPacketCount; }

View file

@ -30,7 +30,6 @@ public slots:
/// threaded run of assignment
virtual void run() = 0;
Q_INVOKABLE virtual void stop() { setFinished(true); }
virtual void readPendingDatagrams() = 0;
virtual void sendStatsPacket();
signals: