From d90c073102ee8a7d98f145827c3dc6b409ccaba5 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Nov 2015 10:25:18 -0800 Subject: [PATCH] leverage NL keep alive pings in Agent --- assignment-client/src/Agent.cpp | 27 --------------------------- assignment-client/src/Agent.h | 2 -- 2 files changed, 29 deletions(-) diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index 1f56118177..8cc706992a 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -105,7 +105,6 @@ void Agent::handleAudioPacket(QSharedPointer packet) { } const QString AGENT_LOGGING_NAME = "agent"; -const int PING_INTERVAL = 1000; void Agent::run() { ThreadedAssignment::commonInit(AGENT_LOGGING_NAME, NodeType::Agent); @@ -127,10 +126,6 @@ void Agent::run() { << NodeType::MessagesMixer ); - _pingTimer = new QTimer(this); - connect(_pingTimer, SIGNAL(timeout()), SLOT(sendPingRequests())); - _pingTimer->start(PING_INTERVAL); - // figure out the URL for the script for this agent assignment QUrl scriptURL; if (_payload.isEmpty()) { @@ -383,28 +378,6 @@ void Agent::aboutToFinish() { _scriptEngine->stop(); } - if (_pingTimer) { - _pingTimer->stop(); - delete _pingTimer; - } - // our entity tree is going to go away so tell that to the EntityScriptingInterface DependencyManager::get()->setEntityTree(NULL); } - -void Agent::sendPingRequests() { - auto nodeList = DependencyManager::get(); - - nodeList->eachMatchingNode([](const SharedNodePointer& node)->bool { - switch (node->getType()) { - case NodeType::AvatarMixer: - case NodeType::AudioMixer: - case NodeType::EntityServer: - return true; - default: - return false; - } - }, [nodeList](const SharedNodePointer& node) { - nodeList->sendPacket(nodeList->constructPingPacket(), *node); - }); -} diff --git a/assignment-client/src/Agent.h b/assignment-client/src/Agent.h index ab000015d5..fe1fffce5a 100644 --- a/assignment-client/src/Agent.h +++ b/assignment-client/src/Agent.h @@ -58,14 +58,12 @@ private slots: void handleAudioPacket(QSharedPointer packet); void handleOctreePacket(QSharedPointer packet, SharedNodePointer senderNode); void handleJurisdictionPacket(QSharedPointer packet, SharedNodePointer senderNode); - void sendPingRequests(); void processAgentAvatarAndAudio(float deltaTime); private: std::unique_ptr _scriptEngine; EntityEditPacketSender _entityEditSender; EntityTreeHeadlessViewer _entityViewer; - QTimer* _pingTimer; MixedAudioStream _receivedAudioStream; float _lastReceivedAudioLoudness;