From 500a96ee7ce32f77463db3036f99e1e49152e85d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 16 Sep 2015 12:25:03 -0700 Subject: [PATCH 1/2] guard perpetual AC domain connection if NL thread locked --- libraries/networking/src/ThreadedAssignment.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/ThreadedAssignment.cpp b/libraries/networking/src/ThreadedAssignment.cpp index aee2805f32..a57bbc847c 100644 --- a/libraries/networking/src/ThreadedAssignment.cpp +++ b/libraries/networking/src/ThreadedAssignment.cpp @@ -43,7 +43,9 @@ void ThreadedAssignment::setFinished(bool isFinished) { packetReceiver.setShouldDropPackets(true); if (_domainServerTimer) { - _domainServerTimer->stop(); + // stop the domain-server check in timer by calling deleteLater so it gets cleaned up on NL thread + _domainServerTimer->deleteLater(); + _domainServerTimer = nullptr; } if (_statsTimer) { @@ -65,9 +67,12 @@ void ThreadedAssignment::commonInit(const QString& targetName, NodeType_t nodeTy auto nodeList = DependencyManager::get(); nodeList->setOwnerType(nodeType); - _domainServerTimer = new QTimer(this); + _domainServerTimer = new QTimer(nodeList.data()); connect(_domainServerTimer, SIGNAL(timeout()), this, SLOT(checkInWithDomainServerOrExit())); _domainServerTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS); + + // move the domain server time to the NL so check-ins fire from there + _domainServerTimer->moveToThread(nodeList->thread()); if (shouldSendStats) { // start sending stats packet once we connect to the domain From cc8ad868b8c36a0b5567c2c5bedb19e0e56ab74e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 16 Sep 2015 12:27:57 -0700 Subject: [PATCH 2/2] don't parent DS timer to object in another thread --- libraries/networking/src/ThreadedAssignment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/networking/src/ThreadedAssignment.cpp b/libraries/networking/src/ThreadedAssignment.cpp index a57bbc847c..5f0db9412c 100644 --- a/libraries/networking/src/ThreadedAssignment.cpp +++ b/libraries/networking/src/ThreadedAssignment.cpp @@ -67,7 +67,7 @@ void ThreadedAssignment::commonInit(const QString& targetName, NodeType_t nodeTy auto nodeList = DependencyManager::get(); nodeList->setOwnerType(nodeType); - _domainServerTimer = new QTimer(nodeList.data()); + _domainServerTimer = new QTimer; connect(_domainServerTimer, SIGNAL(timeout()), this, SLOT(checkInWithDomainServerOrExit())); _domainServerTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS);