fix infinate loading if entity server is not running

This commit is contained in:
Dante Ruiz 2018-11-08 17:16:34 -08:00
parent 6bd08325ec
commit 10d045b11b
4 changed files with 17 additions and 2 deletions

View file

@ -5705,6 +5705,7 @@ void Application::update(float deltaTime) {
quint64 now = usecTimestampNow();
if (isServerlessMode() || _octreeProcessor.isLoadSequenceComplete()) {
bool enableInterstitial = DependencyManager::get<NodeList>()->getDomainHandler().getInterstitialModeEnabled();
if (gpuTextureMemSizeStable() || !enableInterstitial) {
// we've received a new full-scene octree stats packet, or it's been long enough to try again anyway
_lastPhysicsCheckTime = now;

View file

@ -11,6 +11,7 @@
#include "SafeLanding.h"
#include <NodeList.h>
#include <SharedUtil.h>
#include "EntityTreeRenderer.h"
@ -19,6 +20,8 @@
#include "Application.h"
const int SafeLanding::SEQUENCE_MODULO = std::numeric_limits<OCTREE_PACKET_SEQUENCE>::max() + 1;
const quint64 MAX_ELAPSED_TIME = 1000; // msec
const quint64 MICRO_TO_MILI_SECONDS = 1000;
namespace {
template<typename T> bool lessThanWraparound(int a, int b) {
@ -107,7 +110,9 @@ void SafeLanding::noteReceivedsequenceNumber(int sequenceNumber) {
}
bool SafeLanding::isLoadSequenceComplete() {
if (isEntityLoadingComplete() && isSequenceNumbersComplete()) {
quint64 elapsedTime = (usecTimestampNow() - _startTime) / MICRO_TO_MILI_SECONDS;
if ((isEntityLoadingComplete() && isSequenceNumbersComplete()) ||
(elapsedTime >= MAX_ELAPSED_TIME && isEntityServerNotRunning() && _sequenceNumbers.empty())) {
Locker lock(_lock);
_initialStart = INVALID_SEQUENCE;
_initialEnd = INVALID_SEQUENCE;
@ -119,6 +124,14 @@ bool SafeLanding::isLoadSequenceComplete() {
return !_trackingEntities;
}
bool SafeLanding::isEntityServerNotRunning() {
auto nodeList = DependencyManager::get<NodeList>();
const auto& domainHandler = nodeList->getDomainHandler();
auto entityServer = nodeList->soloNodeOfType(NodeType::EntityServer);
return (domainHandler.isConnected() && !entityServer);
}
float SafeLanding::loadingProgressPercentage() {
Locker lock(_lock);
static const int MINIMUM_TRACKED_ENTITY_STABILITY_COUNT = 15;

View file

@ -40,6 +40,7 @@ private:
bool isSequenceNumbersComplete();
void debugDumpSequenceIDs() const;
bool isEntityLoadingComplete();
bool isEntityServerNotRunning();
std::mutex _lock;
using Locker = std::lock_guard<std::mutex>;

View file

@ -15,7 +15,7 @@
(function() {
Script.include("/~/system/libraries/Xform.js");
Script.include("/~/system/libraries/globals.js");
var DEBUG = false;
var DEBUG = true;
var TOTAL_LOADING_PROGRESS = 3.7;
var EPSILON = 0.05;
var TEXTURE_EPSILON = 0.01;