mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 15:38:00 +02:00
move all silent node timers into LimitedNodeList
This commit is contained in:
parent
d3bc540919
commit
9f754e40d0
5 changed files with 7 additions and 17 deletions
|
@ -267,10 +267,6 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) {
|
||||||
connect(nodeList.data(), &LimitedNodeList::nodeAdded, this, &DomainServer::nodeAdded);
|
connect(nodeList.data(), &LimitedNodeList::nodeAdded, this, &DomainServer::nodeAdded);
|
||||||
connect(nodeList.data(), &LimitedNodeList::nodeKilled, this, &DomainServer::nodeKilled);
|
connect(nodeList.data(), &LimitedNodeList::nodeKilled, this, &DomainServer::nodeKilled);
|
||||||
|
|
||||||
QTimer* silentNodeTimer = new QTimer(this);
|
|
||||||
connect(silentNodeTimer, SIGNAL(timeout()), nodeList.data(), SLOT(removeSilentNodes()));
|
|
||||||
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
|
||||||
|
|
||||||
connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), SLOT(readAvailableDatagrams()));
|
connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), SLOT(readAvailableDatagrams()));
|
||||||
|
|
||||||
// add whatever static assignments that have been parsed to the queue
|
// add whatever static assignments that have been parsed to the queue
|
||||||
|
|
|
@ -146,7 +146,6 @@ const qint64 MAXIMUM_CACHE_SIZE = 10 * BYTES_PER_GIGABYTES; // 10GB
|
||||||
|
|
||||||
static QTimer* locationUpdateTimer = NULL;
|
static QTimer* locationUpdateTimer = NULL;
|
||||||
static QTimer* balanceUpdateTimer = NULL;
|
static QTimer* balanceUpdateTimer = NULL;
|
||||||
static QTimer* silentNodeTimer = NULL;
|
|
||||||
static QTimer* identityPacketTimer = NULL;
|
static QTimer* identityPacketTimer = NULL;
|
||||||
static QTimer* billboardPacketTimer = NULL;
|
static QTimer* billboardPacketTimer = NULL;
|
||||||
static QTimer* checkFPStimer = NULL;
|
static QTimer* checkFPStimer = NULL;
|
||||||
|
@ -426,12 +425,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
// connect to the packet sent signal of the _entityEditSender
|
// connect to the packet sent signal of the _entityEditSender
|
||||||
connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent);
|
connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent);
|
||||||
|
|
||||||
// move the silentNodeTimer to the _nodeThread
|
|
||||||
silentNodeTimer = new QTimer();
|
|
||||||
connect(silentNodeTimer, SIGNAL(timeout()), nodeList.data(), SLOT(removeSilentNodes()));
|
|
||||||
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
|
||||||
silentNodeTimer->moveToThread(_nodeThread);
|
|
||||||
|
|
||||||
// send the identity packet for our avatar each second to our avatar mixer
|
// send the identity packet for our avatar each second to our avatar mixer
|
||||||
identityPacketTimer = new QTimer();
|
identityPacketTimer = new QTimer();
|
||||||
connect(identityPacketTimer, &QTimer::timeout, _myAvatar, &MyAvatar::sendIdentityPacket);
|
connect(identityPacketTimer, &QTimer::timeout, _myAvatar, &MyAvatar::sendIdentityPacket);
|
||||||
|
@ -548,7 +541,6 @@ void Application::cleanupBeforeQuit() {
|
||||||
// depending on what thread they run in
|
// depending on what thread they run in
|
||||||
locationUpdateTimer->stop();
|
locationUpdateTimer->stop();
|
||||||
balanceUpdateTimer->stop();
|
balanceUpdateTimer->stop();
|
||||||
QMetaObject::invokeMethod(silentNodeTimer, "stop", Qt::BlockingQueuedConnection);
|
|
||||||
identityPacketTimer->stop();
|
identityPacketTimer->stop();
|
||||||
billboardPacketTimer->stop();
|
billboardPacketTimer->stop();
|
||||||
checkFPStimer->stop();
|
checkFPStimer->stop();
|
||||||
|
@ -558,7 +550,6 @@ void Application::cleanupBeforeQuit() {
|
||||||
// and then delete those that got created by "new"
|
// and then delete those that got created by "new"
|
||||||
delete locationUpdateTimer;
|
delete locationUpdateTimer;
|
||||||
delete balanceUpdateTimer;
|
delete balanceUpdateTimer;
|
||||||
delete silentNodeTimer;
|
|
||||||
delete identityPacketTimer;
|
delete identityPacketTimer;
|
||||||
delete billboardPacketTimer;
|
delete billboardPacketTimer;
|
||||||
delete checkFPStimer;
|
delete checkFPStimer;
|
||||||
|
|
|
@ -80,6 +80,10 @@ LimitedNodeList::LimitedNodeList(unsigned short socketListenPort, unsigned short
|
||||||
connect(localSocketUpdate, &QTimer::timeout, this, &LimitedNodeList::updateLocalSockAddr);
|
connect(localSocketUpdate, &QTimer::timeout, this, &LimitedNodeList::updateLocalSockAddr);
|
||||||
localSocketUpdate->start(LOCAL_SOCKET_UPDATE_INTERVAL_MSECS);
|
localSocketUpdate->start(LOCAL_SOCKET_UPDATE_INTERVAL_MSECS);
|
||||||
|
|
||||||
|
QTimer* silentNodeTimer = new QTimer(this);
|
||||||
|
connect(silentNodeTimer, &QTimer::timeout, this, &LimitedNodeList::removeSilentNodes);
|
||||||
|
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
||||||
|
|
||||||
// check the local socket right now
|
// check the local socket right now
|
||||||
updateLocalSockAddr();
|
updateLocalSockAddr();
|
||||||
|
|
||||||
|
@ -500,6 +504,7 @@ void LimitedNodeList::resetPacketStats() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimitedNodeList::removeSilentNodes() {
|
void LimitedNodeList::removeSilentNodes() {
|
||||||
|
|
||||||
QSet<SharedNodePointer> killedNodes;
|
QSet<SharedNodePointer> killedNodes;
|
||||||
|
|
||||||
eachNodeHashIterator([&](NodeHash::iterator& it){
|
eachNodeHashIterator([&](NodeHash::iterator& it){
|
||||||
|
|
|
@ -223,6 +223,8 @@ protected:
|
||||||
HifiSockAddr _localSockAddr;
|
HifiSockAddr _localSockAddr;
|
||||||
HifiSockAddr _publicSockAddr;
|
HifiSockAddr _publicSockAddr;
|
||||||
HifiSockAddr _stunSockAddr;
|
HifiSockAddr _stunSockAddr;
|
||||||
|
|
||||||
|
QTimer* _silentNodeTimer;
|
||||||
|
|
||||||
// XXX can BandwidthRecorder be used for this?
|
// XXX can BandwidthRecorder be used for this?
|
||||||
int _numCollectedPackets;
|
int _numCollectedPackets;
|
||||||
|
|
|
@ -67,10 +67,6 @@ void ThreadedAssignment::commonInit(const QString& targetName, NodeType_t nodeTy
|
||||||
connect(domainServerTimer, SIGNAL(timeout()), this, SLOT(checkInWithDomainServerOrExit()));
|
connect(domainServerTimer, SIGNAL(timeout()), this, SLOT(checkInWithDomainServerOrExit()));
|
||||||
domainServerTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS);
|
domainServerTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS);
|
||||||
|
|
||||||
QTimer* silentNodeRemovalTimer = new QTimer(this);
|
|
||||||
connect(silentNodeRemovalTimer, SIGNAL(timeout()), nodeList.data(), SLOT(removeSilentNodes()));
|
|
||||||
silentNodeRemovalTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
|
||||||
|
|
||||||
if (shouldSendStats) {
|
if (shouldSendStats) {
|
||||||
// send a stats packet every 1 second
|
// send a stats packet every 1 second
|
||||||
QTimer* statsTimer = new QTimer(this);
|
QTimer* statsTimer = new QTimer(this);
|
||||||
|
|
Loading…
Reference in a new issue