mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 07:09:47 +02:00
Merge pull request #8860 from davidkelly/dk/2004
Fix for sandbox startup issue
This commit is contained in:
commit
ba9d9f6ab7
1 changed files with 12 additions and 7 deletions
|
@ -583,19 +583,24 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
|
|
||||||
bool wantsSandboxRunning = shouldRunServer();
|
bool wantsSandboxRunning = shouldRunServer();
|
||||||
static bool determinedSandboxState = false;
|
static bool determinedSandboxState = false;
|
||||||
|
static bool sandboxIsRunning = false;
|
||||||
SandboxUtils sandboxUtils;
|
SandboxUtils sandboxUtils;
|
||||||
sandboxUtils.ifLocalSandboxRunningElse([&]() {
|
sandboxUtils.ifLocalSandboxRunningElse([&]() {
|
||||||
qCDebug(interfaceapp) << "Home sandbox appears to be running.....";
|
qCDebug(interfaceapp) << "Home sandbox appears to be running.....";
|
||||||
determinedSandboxState = true;
|
determinedSandboxState = true;
|
||||||
|
sandboxIsRunning = true;
|
||||||
}, [&, wantsSandboxRunning]() {
|
}, [&, wantsSandboxRunning]() {
|
||||||
qCDebug(interfaceapp) << "Home sandbox does not appear to be running....";
|
qCDebug(interfaceapp) << "Home sandbox does not appear to be running....";
|
||||||
determinedSandboxState = true;
|
|
||||||
if (wantsSandboxRunning) {
|
if (wantsSandboxRunning) {
|
||||||
QString contentPath = getRunServerPath();
|
QString contentPath = getRunServerPath();
|
||||||
SandboxUtils::runLocalSandbox(contentPath, true, RUNNING_MARKER_FILENAME);
|
SandboxUtils::runLocalSandbox(contentPath, true, RUNNING_MARKER_FILENAME);
|
||||||
|
sandboxIsRunning = true;
|
||||||
}
|
}
|
||||||
|
determinedSandboxState = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// SandboxUtils::runLocalSandbox currently has 2 sec delay after spawning sandbox, so 4
|
||||||
|
// sec here is ok I guess. TODO: ping sandbox so we know it is up, perhaps?
|
||||||
quint64 MAX_WAIT_TIME = USECS_PER_SECOND * 4;
|
quint64 MAX_WAIT_TIME = USECS_PER_SECOND * 4;
|
||||||
auto startWaiting = usecTimestampNow();
|
auto startWaiting = usecTimestampNow();
|
||||||
while (!determinedSandboxState && (usecTimestampNow() - startWaiting <= MAX_WAIT_TIME)) {
|
while (!determinedSandboxState && (usecTimestampNow() - startWaiting <= MAX_WAIT_TIME)) {
|
||||||
|
@ -1326,10 +1331,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
const QString TUTORIAL_PATH = "/tutorial_begin";
|
const QString TUTORIAL_PATH = "/tutorial_begin";
|
||||||
|
|
||||||
if (shouldGoToTutorial) {
|
if (shouldGoToTutorial) {
|
||||||
sandboxUtils.ifLocalSandboxRunningElse([=]() {
|
if(sandboxIsRunning) {
|
||||||
qCDebug(interfaceapp) << "Home sandbox appears to be running, going to Home.";
|
qCDebug(interfaceapp) << "Home sandbox appears to be running, going to Home.";
|
||||||
DependencyManager::get<AddressManager>()->goToLocalSandbox(TUTORIAL_PATH);
|
DependencyManager::get<AddressManager>()->goToLocalSandbox(TUTORIAL_PATH);
|
||||||
}, [=]() {
|
} else {
|
||||||
qCDebug(interfaceapp) << "Home sandbox does not appear to be running, going to Entry.";
|
qCDebug(interfaceapp) << "Home sandbox does not appear to be running, going to Entry.";
|
||||||
if (firstRun.get()) {
|
if (firstRun.get()) {
|
||||||
showHelp();
|
showHelp();
|
||||||
|
@ -1339,7 +1344,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
} else {
|
} else {
|
||||||
DependencyManager::get<AddressManager>()->loadSettings(addressLookupString);
|
DependencyManager::get<AddressManager>()->loadSettings(addressLookupString);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
bool isFirstRun = firstRun.get();
|
bool isFirstRun = firstRun.get();
|
||||||
|
@ -1351,13 +1356,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
// If this is a first run we short-circuit the address passed in
|
// If this is a first run we short-circuit the address passed in
|
||||||
if (isFirstRun) {
|
if (isFirstRun) {
|
||||||
if (hasHMDAndHandControllers) {
|
if (hasHMDAndHandControllers) {
|
||||||
sandboxUtils.ifLocalSandboxRunningElse([=]() {
|
if(sandboxIsRunning) {
|
||||||
qCDebug(interfaceapp) << "Home sandbox appears to be running, going to Home.";
|
qCDebug(interfaceapp) << "Home sandbox appears to be running, going to Home.";
|
||||||
DependencyManager::get<AddressManager>()->goToLocalSandbox();
|
DependencyManager::get<AddressManager>()->goToLocalSandbox();
|
||||||
}, [=]() {
|
} else {
|
||||||
qCDebug(interfaceapp) << "Home sandbox does not appear to be running, going to Entry.";
|
qCDebug(interfaceapp) << "Home sandbox does not appear to be running, going to Entry.";
|
||||||
DependencyManager::get<AddressManager>()->goToEntry();
|
DependencyManager::get<AddressManager>()->goToEntry();
|
||||||
});
|
}
|
||||||
} else {
|
} else {
|
||||||
DependencyManager::get<AddressManager>()->goToEntry();
|
DependencyManager::get<AddressManager>()->goToEntry();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue