mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:03:35 +02:00
Update AssetServerError enum to be camelcase
This commit is contained in:
parent
251203caf1
commit
db92e3155c
6 changed files with 18 additions and 18 deletions
|
@ -113,11 +113,11 @@ void AssetServer::handleAssetGetInfo(QSharedPointer<NLPacket> packet, SharedNode
|
||||||
|
|
||||||
if (fileInfo.exists() && fileInfo.isReadable()) {
|
if (fileInfo.exists() && fileInfo.isReadable()) {
|
||||||
qDebug() << "Opening file: " << fileInfo.filePath();
|
qDebug() << "Opening file: " << fileInfo.filePath();
|
||||||
replyPacket->writePrimitive(AssetServerError::NO_ERROR);
|
replyPacket->writePrimitive(AssetServerError::NoError);
|
||||||
replyPacket->writePrimitive(fileInfo.size());
|
replyPacket->writePrimitive(fileInfo.size());
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Asset not found: " << QString(hexHash);
|
qDebug() << "Asset not found: " << QString(hexHash);
|
||||||
replyPacket->writePrimitive(AssetServerError::ASSET_NOT_FOUND);
|
replyPacket->writePrimitive(AssetServerError::AssetNotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
@ -157,7 +157,7 @@ void AssetServer::handleAssetUpload(QSharedPointer<NLPacketList> packetList, Sha
|
||||||
|
|
||||||
// write the message ID and a permission denied error
|
// write the message ID and a permission denied error
|
||||||
permissionErrorPacket->writePrimitive(messageID);
|
permissionErrorPacket->writePrimitive(messageID);
|
||||||
permissionErrorPacket->writePrimitive(AssetServerError::PERMISSION_DENIED);
|
permissionErrorPacket->writePrimitive(AssetServerError::PermissionDenied);
|
||||||
|
|
||||||
// send off the packet
|
// send off the packet
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
|
@ -55,7 +55,7 @@ void SendAssetTask::run() {
|
||||||
replyPacketList->writePrimitive(messageID);
|
replyPacketList->writePrimitive(messageID);
|
||||||
|
|
||||||
if (end <= start) {
|
if (end <= start) {
|
||||||
writeError(replyPacketList.get(), AssetServerError::INVALID_BYTE_RANGE);
|
writeError(replyPacketList.get(), AssetServerError::InvalidByteRange);
|
||||||
} else {
|
} else {
|
||||||
QString filePath = _resourcesDir.filePath(QString(hexHash) + "." + QString(extension));
|
QString filePath = _resourcesDir.filePath(QString(hexHash) + "." + QString(extension));
|
||||||
|
|
||||||
|
@ -63,12 +63,12 @@ void SendAssetTask::run() {
|
||||||
|
|
||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
if (file.size() < end) {
|
if (file.size() < end) {
|
||||||
writeError(replyPacketList.get(), AssetServerError::INVALID_BYTE_RANGE);
|
writeError(replyPacketList.get(), AssetServerError::InvalidByteRange);
|
||||||
qCDebug(networking) << "Bad byte range: " << hexHash << " " << start << ":" << end;
|
qCDebug(networking) << "Bad byte range: " << hexHash << " " << start << ":" << end;
|
||||||
} else {
|
} else {
|
||||||
auto size = end - start;
|
auto size = end - start;
|
||||||
file.seek(start);
|
file.seek(start);
|
||||||
replyPacketList->writePrimitive(AssetServerError::NO_ERROR);
|
replyPacketList->writePrimitive(AssetServerError::NoError);
|
||||||
replyPacketList->writePrimitive(size);
|
replyPacketList->writePrimitive(size);
|
||||||
replyPacketList->write(file.read(size));
|
replyPacketList->write(file.read(size));
|
||||||
qCDebug(networking) << "Sending asset: " << hexHash;
|
qCDebug(networking) << "Sending asset: " << hexHash;
|
||||||
|
@ -76,7 +76,7 @@ void SendAssetTask::run() {
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
qCDebug(networking) << "Asset not found: " << filePath << "(" << hexHash << ")";
|
qCDebug(networking) << "Asset not found: " << filePath << "(" << hexHash << ")";
|
||||||
writeError(replyPacketList.get(), AssetServerError::ASSET_NOT_FOUND);
|
writeError(replyPacketList.get(), AssetServerError::AssetNotFound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ void UploadAssetTask::run() {
|
||||||
replyPacket->writePrimitive(messageID);
|
replyPacket->writePrimitive(messageID);
|
||||||
|
|
||||||
if (fileSize > MAX_UPLOAD_SIZE) {
|
if (fileSize > MAX_UPLOAD_SIZE) {
|
||||||
replyPacket->writePrimitive(AssetServerError::ASSET_TOO_LARGE);
|
replyPacket->writePrimitive(AssetServerError::AssetTooLarge);
|
||||||
} else {
|
} else {
|
||||||
QByteArray fileData = buffer.read(fileSize);
|
QByteArray fileData = buffer.read(fileSize);
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ void UploadAssetTask::run() {
|
||||||
file.write(fileData);
|
file.write(fileData);
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
replyPacket->writePrimitive(AssetServerError::NO_ERROR);
|
replyPacket->writePrimitive(AssetServerError::NoError);
|
||||||
replyPacket->write(hash);
|
replyPacket->write(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ void AssetResourceRequest::doSend() {
|
||||||
_data = req->getData();
|
_data = req->getData();
|
||||||
_result = Success;
|
_result = Success;
|
||||||
break;
|
break;
|
||||||
case ASSET_NOT_FOUND:
|
case AssetNotFound:
|
||||||
_result = NotFound;
|
_result = NotFound;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -43,13 +43,13 @@ void AssetUpload::start() {
|
||||||
|
|
||||||
assetClient->uploadAsset(data, _extension, [this](AssetServerError error, const QString& hash){
|
assetClient->uploadAsset(data, _extension, [this](AssetServerError error, const QString& hash){
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case NO_ERROR:
|
case AssetServerError::NoError:
|
||||||
_result = Success;
|
_result = Success;
|
||||||
break;
|
break;
|
||||||
case ASSET_TOO_LARGE:
|
case AssetServerError::AssetTooLarge:
|
||||||
_result = TooLarge;
|
_result = TooLarge;
|
||||||
break;
|
break;
|
||||||
case PERMISSION_DENIED:
|
case AssetServerError::PermissionDenied:
|
||||||
_result = PermissionDenied;
|
_result = PermissionDenied;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -22,11 +22,11 @@ const size_t SHA256_HASH_HEX_LENGTH = 64;
|
||||||
const uint64_t MAX_UPLOAD_SIZE = 1000 * 1000 * 1000; // 1GB
|
const uint64_t MAX_UPLOAD_SIZE = 1000 * 1000 * 1000; // 1GB
|
||||||
|
|
||||||
enum AssetServerError : uint8_t {
|
enum AssetServerError : uint8_t {
|
||||||
NO_ERROR = 0,
|
NoError,
|
||||||
ASSET_NOT_FOUND,
|
AssetNotFound,
|
||||||
INVALID_BYTE_RANGE,
|
InvalidByteRange,
|
||||||
ASSET_TOO_LARGE,
|
AssetTooLarge,
|
||||||
PERMISSION_DENIED
|
PermissionDenied
|
||||||
};
|
};
|
||||||
|
|
||||||
const QString ATP_SCHEME = "atp";
|
const QString ATP_SCHEME = "atp";
|
||||||
|
|
Loading…
Reference in a new issue