Showing the changes to assignment-client/src/assets/SendAssetTask.cpp (1 of 6 files). Show all
Unified · Split
| @@ -55,7 +55,7 @@ void SendAssetTask::run() { · 54 unmodified lines | |||
| 55 | replyPacketList->writePrimitive(messageID); | 55 | replyPacketList->writePrimitive(messageID); |
| 56 | 56 | ||
| 57 | if (end <= start) { | 57 | if (end <= start) { |
| 58 | writeError(replyPacketList.get(), AssetServerError::INVALID_BYTE_RANGE); | 58 | writeError(replyPacketList.get(), AssetServerError::InvalidByteRange); |
| 59 | } else { | 59 | } else { |
| 60 | QString filePath = _resourcesDir.filePath(QString(hexHash) + "." + QString(extension)); | 60 | QString filePath = _resourcesDir.filePath(QString(hexHash) + "." + QString(extension)); |
| 61 | 61 | ||
| @@ -63,12 +63,12 @@ void SendAssetTask::run() { · 1 unmodified line | |||
| 63 | 63 | ||
| 64 | if (file.open(QIODevice::ReadOnly)) { | 64 | if (file.open(QIODevice::ReadOnly)) { |
| 65 | if (file.size() < end) { | 65 | if (file.size() < end) { |
| 66 | writeError(replyPacketList.get(), AssetServerError::INVALID_BYTE_RANGE); | 66 | writeError(replyPacketList.get(), AssetServerError::InvalidByteRange); |
| 67 | qCDebug(networking) << "Bad byte range: " << hexHash << " " << start << ":" << end; | 67 | qCDebug(networking) << "Bad byte range: " << hexHash << " " << start << ":" << end; |
| 68 | } else { | 68 | } else { |
| 69 | auto size = end - start; | 69 | auto size = end - start; |
| 70 | file.seek(start); | 70 | file.seek(start); |
| 71 | replyPacketList->writePrimitive(AssetServerError::NO_ERROR); | 71 | replyPacketList->writePrimitive(AssetServerError::NoError); |
| 72 | replyPacketList->writePrimitive(size); | 72 | replyPacketList->writePrimitive(size); |
| 73 | replyPacketList->write(file.read(size)); | 73 | replyPacketList->write(file.read(size)); |
| 74 | qCDebug(networking) << "Sending asset: " << hexHash; | 74 | qCDebug(networking) << "Sending asset: " << hexHash; |
| @@ -76,7 +76,7 @@ void SendAssetTask::run() { · 1 unmodified line | |||
| 76 | file.close(); | 76 | file.close(); |
| 77 | } else { | 77 | } else { |
| 78 | qCDebug(networking) << "Asset not found: " << filePath << "(" << hexHash << ")"; | 78 | qCDebug(networking) << "Asset not found: " << filePath << "(" << hexHash << ")"; |
| 79 | writeError(replyPacketList.get(), AssetServerError::ASSET_NOT_FOUND); | 79 | writeError(replyPacketList.get(), AssetServerError::AssetNotFound); |
| 80 | } | 80 | } |
| 81 | } | 81 | } |
| 82 | 82 | ||