remove the inlined writeError in AssetServer

This commit is contained in:
Stephen Birarda 2016-03-08 15:45:13 -08:00
parent 8d5111a332
commit 6abd1c50b2
3 changed files with 7 additions and 12 deletions

View file

@ -21,11 +21,12 @@
#include <QtCore/QJsonDocument>
#include <QtCore/QString>
#include <ServerPathUtils.h>
#include "NetworkLogging.h"
#include "NodeType.h"
#include "SendAssetTask.h"
#include "UploadAssetTask.h"
#include <ServerPathUtils.h>
const QString ASSET_SERVER_LOGGING_TARGET_NAME = "asset-server";

View file

@ -12,10 +12,10 @@
#ifndef hifi_AssetServer_h
#define hifi_AssetServer_h
#include <QDir>
#include <QtCore/QDir>
#include <QtCore/QThreadPool>
#include <ThreadedAssignment.h>
#include <QThreadPool>
#include "AssetUtils.h"
#include "ReceivedMessage.h"
@ -60,8 +60,6 @@ private:
/// Rename mapping from `oldPath` to `newPath`. Returns true if successful
bool renameMapping(const AssetPath& oldPath, const AssetPath& newPath);
static void writeError(NLPacketList* packetList, AssetServerError error);
void performMappingMigration();
Mappings _fileMappings;
@ -71,8 +69,4 @@ private:
QThreadPool _taskPool;
};
inline void writeError(NLPacketList* packetList, AssetServerError error) {
packetList->writePrimitive(error);
}
#endif

View file

@ -56,7 +56,7 @@ void SendAssetTask::run() {
replyPacketList->writePrimitive(messageID);
if (end <= start) {
writeError(replyPacketList.get(), AssetServerError::InvalidByteRange);
replyPacketList->writePrimitive(AssetServerError::InvalidByteRange);
} else {
QString filePath = _resourcesDir.filePath(QString(hexHash));
@ -64,7 +64,7 @@ void SendAssetTask::run() {
if (file.open(QIODevice::ReadOnly)) {
if (file.size() < end) {
writeError(replyPacketList.get(), AssetServerError::InvalidByteRange);
replyPacketList->writePrimitive(AssetServerError::InvalidByteRange);
qCDebug(networking) << "Bad byte range: " << hexHash << " " << start << ":" << end;
} else {
auto size = end - start;
@ -77,7 +77,7 @@ void SendAssetTask::run() {
file.close();
} else {
qCDebug(networking) << "Asset not found: " << filePath << "(" << hexHash << ")";
writeError(replyPacketList.get(), AssetServerError::AssetNotFound);
replyPacketList->writePrimitive(AssetServerError::AssetNotFound);
}
}