mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-10 10:34:56 +02:00
allow voxel servers in standalone mode to work with new domain server and assignment client
This commit is contained in:
parent
92fb393e14
commit
100eda6960
3 changed files with 20 additions and 6 deletions
|
@ -167,6 +167,9 @@ int main(int argc, const char* argv[]) {
|
|||
// Start the web server.
|
||||
ctx = mg_start(&callbacks, NULL, options);
|
||||
|
||||
// wait to check on voxel-servers till we've given our NodeList a chance to get a good list
|
||||
int checkForVoxelServerAttempt = 0;
|
||||
|
||||
while (true) {
|
||||
|
||||
::assignmentQueueMutex.lock();
|
||||
|
@ -184,20 +187,25 @@ int main(int argc, const char* argv[]) {
|
|||
::assignmentQueue.push_front(&audioMixerAssignment);
|
||||
}
|
||||
|
||||
// Now handle voxel servers, since there could be more than one, we look for any of them
|
||||
// Now handle voxel servers. Couple of things are special about voxel servers.
|
||||
// 1) They can run standalone, and so we want to wait to ask for an assignment until we've given them sufficient
|
||||
// time to check in with us. So we will look for them, but we want actually add assignments unless we haven't
|
||||
// seen one after a few tries.
|
||||
// 2) They aren't soloNodeOfType() so we have to count them.
|
||||
int voxelServerCount = 0;
|
||||
for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
|
||||
if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
|
||||
voxelServerCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (voxelServerCount == 0 &&
|
||||
const int MIN_VOXEL_SERVER_CHECKS = 10;
|
||||
if (checkForVoxelServerAttempt > MIN_VOXEL_SERVER_CHECKS &&
|
||||
voxelServerCount == 0 &&
|
||||
std::find(::assignmentQueue.begin(), ::assignmentQueue.end(), &voxelServerAssignment) == ::assignmentQueue.end()) {
|
||||
qDebug("Missing an Voxel Server and assignment not in queue. Adding.\n");
|
||||
qDebug("Missing a Voxel Server and assignment not in queue. Adding.\n");
|
||||
::assignmentQueue.push_front(&voxelServerAssignment);
|
||||
}
|
||||
|
||||
checkForVoxelServerAttempt++;
|
||||
|
||||
::assignmentQueueMutex.unlock();
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ NodeWatcher nodeWatcher; // used to cleanup AGENT data when agents are killed
|
|||
|
||||
int VoxelServer::_argc = 0;
|
||||
const char** VoxelServer::_argv = NULL;
|
||||
bool VoxelServer::_dontKillOnMissingDomain = false;
|
||||
|
||||
void attachVoxelNodeDataToNode(Node* newNode) {
|
||||
if (newNode->getLinkedData() == NULL) {
|
||||
|
@ -91,6 +92,9 @@ void VoxelServer::setupDomainAndPort(const char* domain, int port) {
|
|||
NodeList::getInstance()->setDomainHostname(domain);
|
||||
}
|
||||
}
|
||||
|
||||
// If we're running in standalone mode, we don't want to kill ourselves when we haven't heard from a domain
|
||||
_dontKillOnMissingDomain = true;
|
||||
}
|
||||
|
||||
//int main(int argc, const char * argv[]) {
|
||||
|
@ -273,7 +277,8 @@ void VoxelServer::run() {
|
|||
// loop to send to nodes requesting data
|
||||
while (true) {
|
||||
|
||||
if (NodeList::getInstance()->getNumNoReplyDomainCheckIns() == MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
|
||||
if (!_dontKillOnMissingDomain &&
|
||||
NodeList::getInstance()->getNumNoReplyDomainCheckIns() == MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
private:
|
||||
static int _argc;
|
||||
static const char** _argv;
|
||||
static bool _dontKillOnMissingDomain;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue