mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 22:16:58 +02:00
CR
This commit is contained in:
parent
46449256ce
commit
e15ab2ca6c
4 changed files with 4 additions and 9 deletions
|
@ -108,6 +108,7 @@ bool BackupSupervisor::loadBackup(const QString& backupFile) {
|
||||||
auto document = QJsonDocument::fromJson(file.readAll(), &error);
|
auto document = QJsonDocument::fromJson(file.readAll(), &error);
|
||||||
if (document.isNull() || !document.isObject()) {
|
if (document.isNull() || !document.isObject()) {
|
||||||
qCritical() << "Could not parse backup file to JSON object:" << backupFile;
|
qCritical() << "Could not parse backup file to JSON object:" << backupFile;
|
||||||
|
qCritical() << " Error:" << error.errorString();
|
||||||
backup.corruptedBackup = true;
|
backup.corruptedBackup = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -165,7 +166,6 @@ void BackupSupervisor::backupAssetServer() {
|
||||||
});
|
});
|
||||||
|
|
||||||
startBackup();
|
startBackup();
|
||||||
qDebug() << "Requesting mappings for backup!";
|
|
||||||
request->start();
|
request->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ void BackupSupervisor::backupNextMissingFile() {
|
||||||
if (request->getError() == AssetRequest::NoError) {
|
if (request->getError() == AssetRequest::NoError) {
|
||||||
qDebug() << "Got" << request->getHash();
|
qDebug() << "Got" << request->getHash();
|
||||||
|
|
||||||
bool success = writeAssetFile(request->getHash(),request->getData());
|
bool success = writeAssetFile(request->getHash(), request->getData());
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qCritical() << "Failed to write asset file" << request->getHash();
|
qCritical() << "Failed to write asset file" << request->getHash();
|
||||||
}
|
}
|
||||||
|
@ -263,8 +263,6 @@ void BackupSupervisor::restoreAssetServer(int backupIndex) {
|
||||||
auto request = assetClient->createGetAllMappingsRequest();
|
auto request = assetClient->createGetAllMappingsRequest();
|
||||||
|
|
||||||
connect(request, &GetAllMappingsRequest::finished, this, [this, backupIndex](GetAllMappingsRequest* request) {
|
connect(request, &GetAllMappingsRequest::finished, this, [this, backupIndex](GetAllMappingsRequest* request) {
|
||||||
qDebug() << "Got" << request->getMappings().size() << "mappings!";
|
|
||||||
|
|
||||||
if (request->getError() == MappingRequest::NoError) {
|
if (request->getError() == MappingRequest::NoError) {
|
||||||
const auto& newMappings = _backups.at(backupIndex).mappings;
|
const auto& newMappings = _backups.at(backupIndex).mappings;
|
||||||
computeServerStateDifference(request->getMappings(), newMappings);
|
computeServerStateDifference(request->getMappings(), newMappings);
|
||||||
|
@ -278,7 +276,6 @@ void BackupSupervisor::restoreAssetServer(int backupIndex) {
|
||||||
});
|
});
|
||||||
|
|
||||||
startRestore();
|
startRestore();
|
||||||
qDebug() << "Requesting mappings for restore!";
|
|
||||||
request->start();
|
request->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,6 @@ private:
|
||||||
bool writeBackupFile(const AssetUtils::AssetMappings& mappings);
|
bool writeBackupFile(const AssetUtils::AssetMappings& mappings);
|
||||||
bool writeAssetFile(const AssetUtils::AssetHash& hash, const QByteArray& data);
|
bool writeAssetFile(const AssetUtils::AssetHash& hash, const QByteArray& data);
|
||||||
|
|
||||||
|
|
||||||
void startRestore() { _restoreInProgress = true; }
|
void startRestore() { _restoreInProgress = true; }
|
||||||
void finishRestore() { _restoreInProgress = false; }
|
void finishRestore() { _restoreInProgress = false; }
|
||||||
void computeServerStateDifference(const AssetUtils::AssetMappings& currentMappings,
|
void computeServerStateDifference(const AssetUtils::AssetMappings& currentMappings,
|
||||||
|
@ -75,7 +74,7 @@ private:
|
||||||
bool _backupInProgress { false };
|
bool _backupInProgress { false };
|
||||||
std::vector<AssetUtils::AssetHash> _assetsLeftToRequest;
|
std::vector<AssetUtils::AssetHash> _assetsLeftToRequest;
|
||||||
|
|
||||||
// Internal storage for restor in progress
|
// Internal storage for restore in progress
|
||||||
bool _restoreInProgress { false };
|
bool _restoreInProgress { false };
|
||||||
std::vector<AssetUtils::AssetHash> _assetsLeftToUpload;
|
std::vector<AssetUtils::AssetHash> _assetsLeftToUpload;
|
||||||
std::vector<std::pair<AssetUtils::AssetPath, AssetUtils::AssetHash>> _mappingsLeftToSet;
|
std::vector<std::pair<AssetUtils::AssetPath, AssetUtils::AssetHash>> _mappingsLeftToSet;
|
||||||
|
|
|
@ -253,7 +253,6 @@ private:
|
||||||
bool _sendICEServerAddressToMetaverseAPIRedo { false };
|
bool _sendICEServerAddressToMetaverseAPIRedo { false };
|
||||||
|
|
||||||
QHash<QUuid, QPointer<HTTPSConnection>> _pendingOAuthConnections;
|
QHash<QUuid, QPointer<HTTPSConnection>> _pendingOAuthConnections;
|
||||||
BackupSupervisor _backupSupervisor;
|
|
||||||
|
|
||||||
QThread _assetClientThread;
|
QThread _assetClientThread;
|
||||||
};
|
};
|
||||||
|
|
|
@ -315,7 +315,7 @@ void PacketReceiver::handleVerifiedMessage(QSharedPointer<ReceivedMessage> recei
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCDebug(networking).nospace() << "Listener for packet " << receivedMessage->getType()
|
qCDebug(networking).nospace() << "Listener for packet " << receivedMessage->getType()
|
||||||
<< " has been destroyed. Removing from listener map.";
|
<< " has been destroyed. Removing from listener map.";
|
||||||
it = _messageListenerMap.erase(it);
|
it = _messageListenerMap.erase(it);
|
||||||
|
|
||||||
// if it exists, remove the listener from _directlyConnectedObjects
|
// if it exists, remove the listener from _directlyConnectedObjects
|
||||||
|
|
Loading…
Reference in a new issue