summaryrefslogtreecommitdiff
path: root/indra/llmessage/llassetstorage.cpp
diff options
context:
space:
mode:
authorEuclid Linden <euclid@lindenlab.com>2021-03-02 22:41:49 +0000
committerEuclid Linden <euclid@lindenlab.com>2021-03-02 22:41:49 +0000
commita0b9fd6eb0dacfec30df0caac8dbbd7c25366c72 (patch)
tree229a96783c6534a36ce48bdb83108ce26ac24b2f /indra/llmessage/llassetstorage.cpp
parent2cad61d76ba48fe2adfda120bc21ca66166b7385 (diff)
parent10241c5596402a145e4087c36014d84507183c32 (diff)
Merged in DV528-merge-6.4.15 (pull request #484)
DRTVWR-528 merge up to 6.4.15
Diffstat (limited to 'indra/llmessage/llassetstorage.cpp')
-rw-r--r--indra/llmessage/llassetstorage.cpp97
1 files changed, 44 insertions, 53 deletions
diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp
index d7801b6ddc..f38a5e663e 100644
--- a/indra/llmessage/llassetstorage.cpp
+++ b/indra/llmessage/llassetstorage.cpp
@@ -42,8 +42,7 @@
// this library includes
#include "message.h"
#include "llxfermanager.h"
-#include "llvfile.h"
-#include "llvfs.h"
+#include "llfilesystem.h"
#include "lldbstrings.h"
#include "lltransfersourceasset.h"
@@ -202,7 +201,7 @@ LLBaseDownloadRequest::LLBaseDownloadRequest(const LLUUID &uuid, const LLAssetTy
mIsTemp(FALSE),
mIsPriority(FALSE),
mDataSentInFirstPacket(FALSE),
- mDataIsInVFS(FALSE)
+ mDataIsInCache(FALSE)
{
// Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been
// running a message system loop.
@@ -266,7 +265,8 @@ LLSD LLAssetRequest::getFullDetails() const
sd["is_local"] = mIsLocal;
sd["is_priority"] = mIsPriority;
sd["data_send_in_first_packet"] = mDataSentInFirstPacket;
- sd["data_is_in_vfs"] = mDataIsInVFS;
+ // Note: cannot change this (easily) since it is consumed by server
+ sd["data_is_in_vfs"] = mDataIsInCache;
return sd;
}
@@ -330,28 +330,23 @@ LLBaseDownloadRequest* LLEstateAssetRequest::getCopy()
// TODO: rework tempfile handling?
-LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, LLVFS *static_vfs, const LLHost &upstream_host)
+LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, const LLHost &upstream_host)
{
- _init(msg, xfer, vfs, static_vfs, upstream_host);
+ _init(msg, xfer, upstream_host);
}
-LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
- LLVFS *vfs, LLVFS *static_vfs)
+LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer)
{
- _init(msg, xfer, vfs, static_vfs, LLHost());
+ _init(msg, xfer, LLHost());
}
void LLAssetStorage::_init(LLMessageSystem *msg,
LLXferManager *xfer,
- LLVFS *vfs,
- LLVFS *static_vfs,
const LLHost &upstream_host)
{
mShutDown = FALSE;
mMessageSys = msg;
mXferManager = xfer;
- mVFS = vfs;
- mStaticVFS = static_vfs;
setUpstream(upstream_host);
msg->setHandlerFuncFast(_PREHASH_AssetUploadComplete, processUploadComplete, (void **)this);
@@ -430,7 +425,7 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error)
}
if (tmp->mDownCallback)
{
- tmp->mDownCallback(mVFS, tmp->getUUID(), tmp->getType(), tmp->mUserData, error, LLExtStat::NONE);
+ tmp->mDownCallback(tmp->getUUID(), tmp->getType(), tmp->mUserData, error, LLExtStat::NONE);
}
if (tmp->mInfoCallback)
{
@@ -443,10 +438,10 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error)
BOOL LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType type)
{
- return mStaticVFS->getExists(uuid, type) || mVFS->getExists(uuid, type);
+ return LLFileSystem::getExists(uuid, type);
}
-bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type,
+bool LLAssetStorage::findInCacheAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type,
LLGetAssetCallback callback, void *user_data)
{
if (user_data)
@@ -455,17 +450,17 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse
llassert(callback != NULL);
}
- BOOL exists = mStaticVFS->getExists(uuid, type);
+ BOOL exists = LLFileSystem::getExists(uuid, type);
if (exists)
{
- LLVFile file(mStaticVFS, uuid, type);
+ LLFileSystem file(uuid, type);
U32 size = file.getSize();
if (size > 0)
{
// we've already got the file
if (callback)
{
- callback(mStaticVFS, uuid, type, user_data, LL_ERR_NOERR, LLExtStat::VFS_CACHED);
+ callback(uuid, type, user_data, LL_ERR_NOERR, LLExtStat::CACHE_CACHED);
}
return true;
}
@@ -506,7 +501,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,
if (callback)
{
add(sFailedDownloadCount, 1);
- callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_FAILED, LLExtStat::NONE);
+ callback(uuid, type, user_data, LL_ERR_ASSET_REQUEST_FAILED, LLExtStat::NONE);
}
return;
}
@@ -517,20 +512,19 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,
if (callback)
{
add(sFailedDownloadCount, 1);
- callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LLExtStat::NULL_UUID);
+ callback(uuid, type, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LLExtStat::NULL_UUID);
}
return;
}
- // Try static VFS first.
- if (findInStaticVFSAndInvokeCallback(uuid,type,callback,user_data))
+ if (findInCacheAndInvokeCallback(uuid,type,callback,user_data))
{
- LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in static VFS" << LL_ENDL;
+ LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in cache" << LL_ENDL;
return;
}
- BOOL exists = mVFS->getExists(uuid, type);
- LLVFile file(mVFS, uuid, type);
+ BOOL exists = LLFileSystem::getExists(uuid, type);
+ LLFileSystem file(uuid, type);
U32 size = exists ? file.getSize() : 0;
if (size > 0)
@@ -540,10 +534,10 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,
// unless there's a weird error
if (callback)
{
- callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LLExtStat::VFS_CACHED);
+ callback(uuid, type, user_data, LL_ERR_NOERR, LLExtStat::CACHE_CACHED);
}
- LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in VFS" << LL_ENDL;
+ LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in cache" << LL_ENDL;
}
else
{
@@ -616,7 +610,7 @@ void LLAssetStorage::removeAndCallbackPendingDownloads(const LLUUID& file_id, LL
{
add(sFailedDownloadCount, 1);
}
- tmp->mDownCallback(gAssetStorage->mVFS, callback_id, callback_type, tmp->mUserData, result_code, ext_status);
+ tmp->mDownCallback(callback_id, callback_type, tmp->mUserData, result_code, ext_status);
}
delete tmp;
}
@@ -670,7 +664,7 @@ void LLAssetStorage::downloadCompleteCallback(
if (LL_ERR_NOERR == result)
{
// we might have gotten a zero-size file
- LLVFile vfile(gAssetStorage->mVFS, callback_id, callback_type);
+ LLFileSystem vfile(callback_id, callback_type);
if (vfile.getSize() <= 0)
{
LL_WARNS("AssetStorage") << "downloadCompleteCallback has non-existent or zero-size asset " << callback_id << LL_ENDL;
@@ -719,19 +713,19 @@ void LLAssetStorage::getEstateAsset(
if (callback)
{
add(sFailedDownloadCount, 1);
- callback(mVFS, asset_id, atype, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LLExtStat::NULL_UUID);
+ callback(asset_id, atype, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LLExtStat::NULL_UUID);
}
return;
}
- // Try static VFS first.
- if (findInStaticVFSAndInvokeCallback(asset_id,atype,callback,user_data))
+ // Try static first.
+ if (findInCacheAndInvokeCallback(asset_id,atype,callback,user_data))
{
return;
}
- BOOL exists = mVFS->getExists(asset_id, atype);
- LLVFile file(mVFS, asset_id, atype);
+ BOOL exists = LLFileSystem::getExists(asset_id, atype);
+ LLFileSystem file(asset_id, atype);
U32 size = exists ? file.getSize() : 0;
if (size > 0)
@@ -741,7 +735,7 @@ void LLAssetStorage::getEstateAsset(
// unless there's a weird error
if (callback)
{
- callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LLExtStat::VFS_CACHED);
+ callback(asset_id, atype, user_data, LL_ERR_NOERR, LLExtStat::CACHE_CACHED);
}
}
else
@@ -792,7 +786,7 @@ void LLAssetStorage::getEstateAsset(
if (callback)
{
add(sFailedDownloadCount, 1);
- callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LLExtStat::NO_UPSTREAM);
+ callback(asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LLExtStat::NO_UPSTREAM);
}
}
}
@@ -824,7 +818,7 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
if (LL_ERR_NOERR == result)
{
// we might have gotten a zero-size file
- LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getAType());
+ LLFileSystem vfile(req->getUUID(), req->getAType());
if (vfile.getSize() <= 0)
{
LL_WARNS("AssetStorage") << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL;
@@ -838,7 +832,7 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
{
add(sFailedDownloadCount, 1);
}
- req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getAType(), req->mUserData, result, ext_status);
+ req->mDownCallback(req->getUUID(), req->getAType(), req->mUserData, result, ext_status);
}
void LLAssetStorage::getInvItemAsset(
@@ -861,14 +855,13 @@ void LLAssetStorage::getInvItemAsset(
if(asset_id.notNull())
{
- // Try static VFS first.
- if (findInStaticVFSAndInvokeCallback( asset_id, atype, callback, user_data))
+ if (findInCacheAndInvokeCallback( asset_id, atype, callback, user_data))
{
return;
}
- exists = mVFS->getExists(asset_id, atype);
- LLVFile file(mVFS, asset_id, atype);
+ exists = LLFileSystem::getExists(asset_id, atype);
+ LLFileSystem file(asset_id, atype);
size = exists ? file.getSize() : 0;
if(exists && size < 1)
{
@@ -885,7 +878,7 @@ void LLAssetStorage::getInvItemAsset(
// unless there's a weird error
if (callback)
{
- callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LLExtStat::VFS_CACHED);
+ callback(asset_id, atype, user_data, LL_ERR_NOERR, LLExtStat::CACHE_CACHED);
}
}
else
@@ -936,7 +929,7 @@ void LLAssetStorage::getInvItemAsset(
if (callback)
{
add(sFailedDownloadCount, 1);
- callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LLExtStat::NO_UPSTREAM);
+ callback(asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LLExtStat::NO_UPSTREAM);
}
}
}
@@ -968,7 +961,7 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
if (LL_ERR_NOERR == result)
{
// we might have gotten a zero-size file
- LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType());
+ LLFileSystem vfile(req->getUUID(), req->getType());
if (vfile.getSize() <= 0)
{
LL_WARNS("AssetStorage") << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL;
@@ -982,7 +975,7 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
{
add(sFailedDownloadCount, 1);
}
- req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), req->mUserData, result, ext_status);
+ req->mDownCallback(req->getUUID(), req->getType(), req->mUserData, result, ext_status);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1293,7 +1286,7 @@ bool LLAssetStorage::deletePendingRequestImpl(LLAssetStorage::request_list_t* re
if (req->mDownCallback)
{
add(sFailedDownloadCount, 1);
- req->mDownCallback(mVFS, req->getUUID(), req->getType(), req->mUserData, error, LLExtStat::REQUEST_DROPPED);
+ req->mDownCallback(req->getUUID(), req->getType(), req->mUserData, error, LLExtStat::REQUEST_DROPPED);
}
if (req->mInfoCallback)
{
@@ -1363,8 +1356,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,
{
LLAssetRequest* tmp = *iter++;
- //void(*const* cbptr)(LLVFS *, const LLUUID &, LLAssetType::EType, void *, S32, LLExtStat)
- auto cbptr = tmp->mDownCallback.target<void(*)(LLVFS *, const LLUUID &, LLAssetType::EType, void *, S32, LLExtStat)>();
+ auto cbptr = tmp->mDownCallback.target<void(*)(const LLUUID &, LLAssetType::EType, void *, S32, LLExtStat)>();
if (type == tmp->getType() &&
uuid == tmp->getUUID() &&
@@ -1389,8 +1381,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,
}
// static
-void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs,
- const LLUUID &uuid,
+void LLAssetStorage::legacyGetDataCallback(const LLUUID &uuid,
LLAssetType::EType type,
void *user_data,
S32 status,
@@ -1405,7 +1396,7 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs,
if ( !status
&& !toxic )
{
- LLVFile file(vfs, uuid, type);
+ LLFileSystem file(uuid, type);
std::string uuid_str;