mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 20:03:00 +02:00
drop assignment even if DDOS locks NL thread
This commit is contained in:
parent
0e016838b4
commit
e50e75cba7
4 changed files with 18 additions and 1 deletions
libraries/networking/src
|
@ -490,6 +490,9 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
|
|||
// this is a packet from the domain server, reset the count of un-replied check-ins
|
||||
_numNoReplyDomainCheckIns = 0;
|
||||
|
||||
// emit our signal so listeners know we just heard from the DS
|
||||
emit receivedDomainServerList();
|
||||
|
||||
DependencyManager::get<NodeList>()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::ReceiveDSList);
|
||||
|
||||
QDataStream packetStream(message->getMessage());
|
||||
|
|
|
@ -87,6 +87,7 @@ public slots:
|
|||
|
||||
signals:
|
||||
void limitOfSilentDomainCheckInsReached();
|
||||
void receivedDomainServerList();
|
||||
private slots:
|
||||
void stopKeepalivePingTimer();
|
||||
void sendPendingDSPathQuery();
|
||||
|
|
|
@ -30,6 +30,10 @@ ThreadedAssignment::ThreadedAssignment(ReceivedMessage& message) :
|
|||
|
||||
connect(&_domainServerTimer, &QTimer::timeout, this, &ThreadedAssignment::checkInWithDomainServerOrExit);
|
||||
_domainServerTimer.setInterval(DOMAIN_SERVER_CHECK_IN_MSECS);
|
||||
|
||||
// if the NL tells us we got a DS response, clear our member variable of queued check-ins
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
connect(nodeList.data(), &NodeList::receivedDomainServerList, this, &ThreadedAssignment::clearQueuedCheckIns);
|
||||
}
|
||||
|
||||
void ThreadedAssignment::setFinished(bool isFinished) {
|
||||
|
@ -103,11 +107,18 @@ void ThreadedAssignment::sendStatsPacket() {
|
|||
}
|
||||
|
||||
void ThreadedAssignment::checkInWithDomainServerOrExit() {
|
||||
if (DependencyManager::get<NodeList>()->getNumNoReplyDomainCheckIns() == MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
|
||||
qDebug() << "WE ARE AT" << _numQueuedCheckIns << "queued check-ins";
|
||||
|
||||
// verify that the number of queued check-ins is not >= our max
|
||||
// the number of queued check-ins is cleared anytime we get a response from the domain-server
|
||||
if (_numQueuedCheckIns >= MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
|
||||
setFinished(true);
|
||||
} else {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
QMetaObject::invokeMethod(nodeList.data(), "sendDomainServerCheckIn");
|
||||
|
||||
// increase the number of queued check ins
|
||||
_numQueuedCheckIns++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ public slots:
|
|||
virtual void run() = 0;
|
||||
Q_INVOKABLE virtual void stop() { setFinished(true); }
|
||||
virtual void sendStatsPacket();
|
||||
void clearQueuedCheckIns() { _numQueuedCheckIns = 0; }
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
|
@ -42,6 +43,7 @@ protected:
|
|||
bool _isFinished;
|
||||
QTimer _domainServerTimer;
|
||||
QTimer _statsTimer;
|
||||
int _numQueuedCheckIns { 0 };
|
||||
|
||||
protected slots:
|
||||
void domainSettingsRequestFailed();
|
||||
|
|
Loading…
Reference in a new issue