History

drop assignment even if DDOS locks NL thread

Stephen Birarda committed 10 years ago

Commit e50e75c1 parent 0e016834 files · +18 −1Browse files

Showing the changes to libraries/networking/src/ThreadedAssignment.cpp (1 of 4 files). Show all

Unified · Split

libraries/networking/src/ThreadedAssignment.cpp+12−1
@@ -30,6 +30,10 @@ ThreadedAssignment::ThreadedAssignment(ReceivedMessage& message) : · 29 unmodified lines
3030
3131 connect(&_domainServerTimer, &QTimer::timeout, this, &ThreadedAssignment::checkInWithDomainServerOrExit);
3232 _domainServerTimer.setInterval(DOMAIN_SERVER_CHECK_IN_MSECS);
33+
34+ // if the NL tells us we got a DS response, clear our member variable of queued check-ins
35+ auto nodeList = DependencyManager::get<NodeList>();
36+ connect(nodeList.data(), &NodeList::receivedDomainServerList, this, &ThreadedAssignment::clearQueuedCheckIns);
3337 }
3438
3539 void ThreadedAssignment::setFinished(bool isFinished) {
@@ -103,11 +107,18 @@ void ThreadedAssignment::sendStatsPacket() { · 67 unmodified lines
103107 }
104108
105109 void ThreadedAssignment::checkInWithDomainServerOrExit() {
106− if (DependencyManager::get<NodeList>()->getNumNoReplyDomainCheckIns() == MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
110+ qDebug() << "WE ARE AT" << _numQueuedCheckIns << "queued check-ins";
111+
112+ // verify that the number of queued check-ins is not >= our max
113+ // the number of queued check-ins is cleared anytime we get a response from the domain-server
114+ if (_numQueuedCheckIns >= MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
107115 setFinished(true);
108116 } else {
109117 auto nodeList = DependencyManager::get<NodeList>();
110118 QMetaObject::invokeMethod(nodeList.data(), "sendDomainServerCheckIn");
119+
120+ // increase the number of queued check ins
121+ _numQueuedCheckIns++;
111122 }
112123 }
113124