Showing the changes to libraries/shared/src/ThreadedAssignment.cpp (1 of 38 files). Show all
Unified · Split
| @@ -6,6 +6,9 @@ · 5 unmodified lines | |||
| 6 | // Copyright (c) 2013 HighFidelity, Inc. All rights reserved. | 6 | // Copyright (c) 2013 HighFidelity, Inc. All rights reserved. |
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #include <QTimer> | ||
| 10 | |||
| 11 | #include "Logging.h" | ||
| 9 | #include "ThreadedAssignment.h" | 12 | #include "ThreadedAssignment.h" |
| 10 | 13 | ||
| 11 | ThreadedAssignment::ThreadedAssignment(const unsigned char* dataBuffer, int numBytes) : | 14 | ThreadedAssignment::ThreadedAssignment(const unsigned char* dataBuffer, int numBytes) : |
| @@ -23,6 +26,26 @@ void ThreadedAssignment::setFinished(bool isFinished) { · 11 unmodified lines | |||
| 23 | } | 26 | } |
| 24 | } | 27 | } |
| 25 | 28 | ||
| 29 | void ThreadedAssignment::commonInit(const char* targetName, NODE_TYPE nodeType) { | ||
| 30 | // change the logging target name while the assignment is running | ||
| 31 | Logging::setTargetName(targetName); | ||
| 32 | |||
| 33 | NodeList* nodeList = NodeList::getInstance(); | ||
| 34 | nodeList->setOwnerType(nodeType); | ||
| 35 | |||
| 36 | QTimer* domainServerTimer = new QTimer(this); | ||
| 37 | connect(domainServerTimer, SIGNAL(timeout()), this, SLOT(checkInWithDomainServerOrExit())); | ||
| 38 | domainServerTimer->start(DOMAIN_SERVER_CHECK_IN_USECS / 1000); | ||
| 39 | |||
| 40 | QTimer* pingNodesTimer = new QTimer(this); | ||
| 41 | connect(pingNodesTimer, SIGNAL(timeout()), nodeList, SLOT(pingInactiveNodes())); | ||
| 42 | pingNodesTimer->start(PING_INACTIVE_NODE_INTERVAL_USECS / 1000); | ||
| 43 | |||
| 44 | QTimer* silentNodeTimer = new QTimer(this); | ||
| 45 | connect(silentNodeTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes())); | ||
| 46 | silentNodeTimer->start(NODE_SILENCE_THRESHOLD_USECS / 1000); | ||
| 47 | } | ||
| 48 | |||
| 26 | void ThreadedAssignment::checkInWithDomainServerOrExit() { | 49 | void ThreadedAssignment::checkInWithDomainServerOrExit() { |
| 27 | if (NodeList::getInstance()->getNumNoReplyDomainCheckIns() == MAX_SILENT_DOMAIN_SERVER_CHECK_INS) { | 50 | if (NodeList::getInstance()->getNumNoReplyDomainCheckIns() == MAX_SILENT_DOMAIN_SERVER_CHECK_INS) { |
| 28 | setFinished(true); | 51 | setFinished(true); |