mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:48:38 +02:00
Merge pull request #15288 from roxanneskelly/Case21726
Case 21726 - Domain lost recent entity edits upon restart
This commit is contained in:
commit
6ccf16dfe5
2 changed files with 9 additions and 9 deletions
|
@ -1766,14 +1766,14 @@ void DomainServer::processOctreeDataRequestMessage(QSharedPointer<ReceivedMessag
|
||||||
|
|
||||||
bool remoteHasExistingData { false };
|
bool remoteHasExistingData { false };
|
||||||
QUuid id;
|
QUuid id;
|
||||||
int version;
|
int dataVersion;
|
||||||
message->readPrimitive(&remoteHasExistingData);
|
message->readPrimitive(&remoteHasExistingData);
|
||||||
if (remoteHasExistingData) {
|
if (remoteHasExistingData) {
|
||||||
constexpr size_t UUID_SIZE_BYTES = 16;
|
constexpr size_t UUID_SIZE_BYTES = 16;
|
||||||
auto idData = message->read(UUID_SIZE_BYTES);
|
auto idData = message->read(UUID_SIZE_BYTES);
|
||||||
id = QUuid::fromRfc4122(idData);
|
id = QUuid::fromRfc4122(idData);
|
||||||
message->readPrimitive(&version);
|
message->readPrimitive(&dataVersion);
|
||||||
qCDebug(domain_server) << "Entity server does have existing data: ID(" << id << ") DataVersion(" << version << ")";
|
qCDebug(domain_server) << "Entity server does have existing data: ID(" << id << ") DataVersion(" << dataVersion << ")";
|
||||||
} else {
|
} else {
|
||||||
qCDebug(domain_server) << "Entity server does not have existing data";
|
qCDebug(domain_server) << "Entity server does not have existing data";
|
||||||
}
|
}
|
||||||
|
@ -1782,11 +1782,11 @@ void DomainServer::processOctreeDataRequestMessage(QSharedPointer<ReceivedMessag
|
||||||
auto reply = NLPacketList::create(PacketType::OctreeDataFileReply, QByteArray(), true, true);
|
auto reply = NLPacketList::create(PacketType::OctreeDataFileReply, QByteArray(), true, true);
|
||||||
OctreeUtils::RawEntityData data;
|
OctreeUtils::RawEntityData data;
|
||||||
if (data.readOctreeDataInfoFromFile(entityFilePath)) {
|
if (data.readOctreeDataInfoFromFile(entityFilePath)) {
|
||||||
if (data.id == id && data.version <= version) {
|
if (data.id == id && data.dataVersion <= dataVersion) {
|
||||||
qCDebug(domain_server) << "ES has sufficient octree data, not sending data";
|
qCDebug(domain_server) << "ES has sufficient octree data, not sending data";
|
||||||
reply->writePrimitive(false);
|
reply->writePrimitive(false);
|
||||||
} else {
|
} else {
|
||||||
qCDebug(domain_server) << "Sending newer octree data to ES: ID(" << data.id << ") DataVersion(" << data.version << ")";
|
qCDebug(domain_server) << "Sending newer octree data to ES: ID(" << data.id << ") DataVersion(" << data.dataVersion << ")";
|
||||||
QFile file(entityFilePath);
|
QFile file(entityFilePath);
|
||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
reply->writePrimitive(true);
|
reply->writePrimitive(true);
|
||||||
|
|
|
@ -82,11 +82,11 @@ void OctreePersistThread::start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.readOctreeDataInfoFromData(_cachedJSONData)) {
|
if (data.readOctreeDataInfoFromData(_cachedJSONData)) {
|
||||||
qCDebug(octree) << "Current octree data: ID(" << data.id << ") DataVersion(" << data.version << ")";
|
qCDebug(octree) << "Current octree data: ID(" << data.id << ") DataVersion(" << data.dataVersion << ")";
|
||||||
packet->writePrimitive(true);
|
packet->writePrimitive(true);
|
||||||
auto id = data.id.toRfc4122();
|
auto id = data.id.toRfc4122();
|
||||||
packet->write(id);
|
packet->write(id);
|
||||||
packet->writePrimitive(data.version);
|
packet->writePrimitive(data.dataVersion);
|
||||||
} else {
|
} else {
|
||||||
_cachedJSONData.clear();
|
_cachedJSONData.clear();
|
||||||
qCWarning(octree) << "No octree data found";
|
qCWarning(octree) << "No octree data found";
|
||||||
|
@ -144,8 +144,8 @@ void OctreePersistThread::handleOctreeDataFileReply(QSharedPointer<ReceivedMessa
|
||||||
quint64 loadStarted = usecTimestampNow();
|
quint64 loadStarted = usecTimestampNow();
|
||||||
|
|
||||||
if (hasValidOctreeData) {
|
if (hasValidOctreeData) {
|
||||||
qDebug() << "Setting entity version info to: " << data.id << data.version;
|
qDebug() << "Setting entity version info to: " << data.id << data.dataVersion;
|
||||||
_tree->setOctreeVersionInfo(data.id, data.version);
|
_tree->setOctreeVersionInfo(data.id, data.dataVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool persistentFileRead;
|
bool persistentFileRead;
|
||||||
|
|
Loading…
Reference in a new issue