mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-09 02:42:19 +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()) {
|
||||
qDebug() << "Opening file: " << fileInfo.filePath();
|
||||
replyPacket->writePrimitive(AssetServerError::NO_ERROR);
|
||||
replyPacket->writePrimitive(AssetServerError::NoError);
|
||||
replyPacket->writePrimitive(fileInfo.size());
|
||||
} else {
|
||||
qDebug() << "Asset not found: " << QString(hexHash);
|
||||
replyPacket->writePrimitive(AssetServerError::ASSET_NOT_FOUND);
|
||||
replyPacket->writePrimitive(AssetServerError::AssetNotFound);
|
||||
}
|
||||
|
||||
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
|
||||
permissionErrorPacket->writePrimitive(messageID);
|
||||
permissionErrorPacket->writePrimitive(AssetServerError::PERMISSION_DENIED);
|
||||
permissionErrorPacket->writePrimitive(AssetServerError::PermissionDenied);
|
||||
|
||||
// send off the packet
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
|
|
@ -55,7 +55,7 @@ void SendAssetTask::run() {
|
|||
replyPacketList->writePrimitive(messageID);
|
||||
|
||||
if (end <= start) {
|
||||
writeError(replyPacketList.get(), AssetServerError::INVALID_BYTE_RANGE);
|
||||
writeError(replyPacketList.get(), AssetServerError::InvalidByteRange);
|
||||
} else {
|
||||
QString filePath = _resourcesDir.filePath(QString(hexHash) + "." + QString(extension));
|
||||
|
||||
|
@ -63,12 +63,12 @@ void SendAssetTask::run() {
|
|||
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
if (file.size() < end) {
|
||||
writeError(replyPacketList.get(), AssetServerError::INVALID_BYTE_RANGE);
|
||||
writeError(replyPacketList.get(), AssetServerError::InvalidByteRange);
|
||||
qCDebug(networking) << "Bad byte range: " << hexHash << " " << start << ":" << end;
|
||||
} else {
|
||||
auto size = end - start;
|
||||
file.seek(start);
|
||||
replyPacketList->writePrimitive(AssetServerError::NO_ERROR);
|
||||
replyPacketList->writePrimitive(AssetServerError::NoError);
|
||||
replyPacketList->writePrimitive(size);
|
||||
replyPacketList->write(file.read(size));
|
||||
qCDebug(networking) << "Sending asset: " << hexHash;
|
||||
|
@ -76,7 +76,7 @@ void SendAssetTask::run() {
|
|||
file.close();
|
||||
} else {
|
||||
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);
|
||||
|
||||
if (fileSize > MAX_UPLOAD_SIZE) {
|
||||
replyPacket->writePrimitive(AssetServerError::ASSET_TOO_LARGE);
|
||||
replyPacket->writePrimitive(AssetServerError::AssetTooLarge);
|
||||
} else {
|
||||
QByteArray fileData = buffer.read(fileSize);
|
||||
|
||||
|
@ -71,7 +71,7 @@ void UploadAssetTask::run() {
|
|||
file.write(fileData);
|
||||
file.close();
|
||||
}
|
||||
replyPacket->writePrimitive(AssetServerError::NO_ERROR);
|
||||
replyPacket->writePrimitive(AssetServerError::NoError);
|
||||
replyPacket->write(hash);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ void AssetResourceRequest::doSend() {
|
|||
_data = req->getData();
|
||||
_result = Success;
|
||||
break;
|
||||
case ASSET_NOT_FOUND:
|
||||
case AssetNotFound:
|
||||
_result = NotFound;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -43,13 +43,13 @@ void AssetUpload::start() {
|
|||
|
||||
assetClient->uploadAsset(data, _extension, [this](AssetServerError error, const QString& hash){
|
||||
switch (error) {
|
||||
case NO_ERROR:
|
||||
case AssetServerError::NoError:
|
||||
_result = Success;
|
||||
break;
|
||||
case ASSET_TOO_LARGE:
|
||||
case AssetServerError::AssetTooLarge:
|
||||
_result = TooLarge;
|
||||
break;
|
||||
case PERMISSION_DENIED:
|
||||
case AssetServerError::PermissionDenied:
|
||||
_result = PermissionDenied;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -22,11 +22,11 @@ const size_t SHA256_HASH_HEX_LENGTH = 64;
|
|||
const uint64_t MAX_UPLOAD_SIZE = 1000 * 1000 * 1000; // 1GB
|
||||
|
||||
enum AssetServerError : uint8_t {
|
||||
NO_ERROR = 0,
|
||||
ASSET_NOT_FOUND,
|
||||
INVALID_BYTE_RANGE,
|
||||
ASSET_TOO_LARGE,
|
||||
PERMISSION_DENIED
|
||||
NoError,
|
||||
AssetNotFound,
|
||||
InvalidByteRange,
|
||||
AssetTooLarge,
|
||||
PermissionDenied
|
||||
};
|
||||
|
||||
const QString ATP_SCHEME = "atp";
|
||||
|
|
Loading…
Reference in a new issue