leverage NL keep alive pings in Agent

This commit is contained in:
Stephen Birarda 2015-11-18 10:25:18 -08:00
parent 0e3d3451d7
commit d90c073102
2 changed files with 0 additions and 29 deletions

View file

@ -105,7 +105,6 @@ void Agent::handleAudioPacket(QSharedPointer<NLPacket> packet) {
} }
const QString AGENT_LOGGING_NAME = "agent"; const QString AGENT_LOGGING_NAME = "agent";
const int PING_INTERVAL = 1000;
void Agent::run() { void Agent::run() {
ThreadedAssignment::commonInit(AGENT_LOGGING_NAME, NodeType::Agent); ThreadedAssignment::commonInit(AGENT_LOGGING_NAME, NodeType::Agent);
@ -127,10 +126,6 @@ void Agent::run() {
<< NodeType::MessagesMixer << 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 // figure out the URL for the script for this agent assignment
QUrl scriptURL; QUrl scriptURL;
if (_payload.isEmpty()) { if (_payload.isEmpty()) {
@ -383,28 +378,6 @@ void Agent::aboutToFinish() {
_scriptEngine->stop(); _scriptEngine->stop();
} }
if (_pingTimer) {
_pingTimer->stop();
delete _pingTimer;
}
// our entity tree is going to go away so tell that to the EntityScriptingInterface // our entity tree is going to go away so tell that to the EntityScriptingInterface
DependencyManager::get<EntityScriptingInterface>()->setEntityTree(NULL); DependencyManager::get<EntityScriptingInterface>()->setEntityTree(NULL);
} }
void Agent::sendPingRequests() {
auto nodeList = DependencyManager::get<NodeList>();
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);
});
}

View file

@ -58,14 +58,12 @@ private slots:
void handleAudioPacket(QSharedPointer<NLPacket> packet); void handleAudioPacket(QSharedPointer<NLPacket> packet);
void handleOctreePacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode); void handleOctreePacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode);
void handleJurisdictionPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode); void handleJurisdictionPacket(QSharedPointer<NLPacket> packet, SharedNodePointer senderNode);
void sendPingRequests();
void processAgentAvatarAndAudio(float deltaTime); void processAgentAvatarAndAudio(float deltaTime);
private: private:
std::unique_ptr<ScriptEngine> _scriptEngine; std::unique_ptr<ScriptEngine> _scriptEngine;
EntityEditPacketSender _entityEditSender; EntityEditPacketSender _entityEditSender;
EntityTreeHeadlessViewer _entityViewer; EntityTreeHeadlessViewer _entityViewer;
QTimer* _pingTimer;
MixedAudioStream _receivedAudioStream; MixedAudioStream _receivedAudioStream;
float _lastReceivedAudioLoudness; float _lastReceivedAudioLoudness;