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/QJsonDocument>
#include <QtCore/QString> #include <QtCore/QString>
#include <ServerPathUtils.h>
#include "NetworkLogging.h" #include "NetworkLogging.h"
#include "NodeType.h" #include "NodeType.h"
#include "SendAssetTask.h" #include "SendAssetTask.h"
#include "UploadAssetTask.h" #include "UploadAssetTask.h"
#include <ServerPathUtils.h>
const QString ASSET_SERVER_LOGGING_TARGET_NAME = "asset-server"; const QString ASSET_SERVER_LOGGING_TARGET_NAME = "asset-server";

View file

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

View file

@ -56,7 +56,7 @@ void SendAssetTask::run() {
replyPacketList->writePrimitive(messageID); replyPacketList->writePrimitive(messageID);
if (end <= start) { if (end <= start) {
writeError(replyPacketList.get(), AssetServerError::InvalidByteRange); replyPacketList->writePrimitive(AssetServerError::InvalidByteRange);
} else { } else {
QString filePath = _resourcesDir.filePath(QString(hexHash)); QString filePath = _resourcesDir.filePath(QString(hexHash));
@ -64,7 +64,7 @@ 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::InvalidByteRange); replyPacketList->writePrimitive(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;
@ -77,7 +77,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::AssetNotFound); replyPacketList->writePrimitive(AssetServerError::AssetNotFound);
} }
} }