From 142f867d38060d3525dcab1cdd170836e1981ec1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 16 Apr 2010 16:06:34 -0400 Subject: For EXT-6809 - search static VFS for all asset types --- indra/llmessage/llassetstorage.cpp | 105 +++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 38 deletions(-) (limited to 'indra/llmessage/llassetstorage.cpp') diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 0ab1081200..c3a786d59c 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -283,28 +283,30 @@ LLEstateAssetRequest::~LLEstateAssetRequest() // TODO: rework tempfile handling? -LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, const LLHost &upstream_host) +LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, LLVFS *static_vfs, const LLHost &upstream_host) { - _init(msg, xfer, vfs, upstream_host); + _init(msg, xfer, vfs, static_vfs, upstream_host); } LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, - LLVFS *vfs) + LLVFS *vfs, LLVFS *static_vfs) { - _init(msg, xfer, vfs, LLHost::invalid); + _init(msg, xfer, vfs, static_vfs, LLHost::invalid); } 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); @@ -396,7 +398,7 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error) BOOL LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType type) { - return mVFS->getExists(uuid, type); + return mStaticVFS->getExists(uuid, type) || mVFS->getExists(uuid, type); } /////////////////////////////////////////////////////////////////////////// @@ -423,11 +425,48 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo return; } + { + // Try in static VFS first. + BOOL exists = mStaticVFS->getExists(uuid, type); + //exists = false; + if (exists) + { + LLVFile file(mStaticVFS, uuid, type); + U32 size = exists ? file.getSize() : 0; + if (size>0) + { + // we've already got the file + // theoretically, partial files w/o a pending request shouldn't happen + // unless there's a weird error + if (callback) + { + callback(mStaticVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); + } + return; + } + else + { + llwarns << "Asset vfile " << uuid << ":" << type + << " found in static VFS with bad size " << file.getSize() << ", ignoring" << llendl; + } + } + } + BOOL exists = mVFS->getExists(uuid, type); LLVFile file(mVFS, uuid, type); U32 size = exists ? file.getSize() : 0; - if (size < 1) + if (size > 0) + { + // we've already got the file + // theoretically, partial files w/o a pending request shouldn't happen + // unless there's a weird error + if (callback) + { + callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); + } + } + else { if (exists) { @@ -466,16 +505,6 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo // This can be overridden by subclasses _queueDataRequest(uuid, type, callback, user_data, duplicate, is_priority); } - else - { - // we've already got the file - // theoretically, partial files w/o a pending request shouldn't happen - // unless there's a weird error - if (callback) - { - callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); - } - } } void LLAssetStorage::_queueDataRequest(const LLUUID& uuid, LLAssetType::EType atype, @@ -620,7 +649,17 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen LLVFile file(mVFS, asset_id, atype); U32 size = exists ? file.getSize() : 0; - if (size < 1) + if (size > 0) + { + // we've already got the file + // theoretically, partial files w/o a pending request shouldn't happen + // unless there's a weird error + if (callback) + { + callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); + } + } + else { if (exists) { @@ -671,16 +710,6 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen } } } - else - { - // we've already got the file - // theoretically, partial files w/o a pending request shouldn't happen - // unless there's a weird error - if (callback) - { - callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); - } - } } void LLAssetStorage::downloadEstateAssetCompleteCallback( @@ -758,7 +787,17 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age } - if (size < 1) + if (size > 0) + { + // we've already got the file + // theoretically, partial files w/o a pending request shouldn't happen + // unless there's a weird error + if (callback) + { + callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); + } + } + else { // See whether we should talk to the object's originating sim, // or the upstream provider. @@ -807,16 +846,6 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age } } } - else - { - // we've already got the file - // theoretically, partial files w/o a pending request shouldn't happen - // unless there's a weird error - if (callback) - { - callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); - } - } } -- cgit v1.2.3 From 3b8ce1d18aafd7c0b4bc5eee4fb74054a7a1a819 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 16 Apr 2010 17:13:11 -0400 Subject: For EXT-6809 - search static VFS for all asset types --- indra/llmessage/llassetstorage.cpp | 68 ++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 25 deletions(-) (limited to 'indra/llmessage/llassetstorage.cpp') diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index c3a786d59c..e65a488098 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -401,12 +401,41 @@ BOOL LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType return mStaticVFS->getExists(uuid, type) || mVFS->getExists(uuid, type); } +bool LLAssetStorage::findInVFSAndInvokeCallback(LLVFS *vfs, const LLUUID& uuid, LLAssetType::EType type, + LLGetAssetCallback callback, void *user_data) +{ + // Try in static VFS first. + BOOL exists = vfs->getExists(uuid, type); + if (exists) + { + LLVFile file(vfs, uuid, type); + U32 size = exists ? file.getSize() : 0; + if (size>0) + { + // we've already got the file + // theoretically, partial files w/o a pending request shouldn't happen + // unless there's a weird error + if (callback) + { + callback(vfs, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); + return true; + } + } + else + { + llwarns << "Asset vfile " << uuid << ":" << type + << " found with bad size " << file.getSize() << ", ignoring" << llendl; + } + } + return false; +} + /////////////////////////////////////////////////////////////////////////// // GET routines /////////////////////////////////////////////////////////////////////////// // IW - uuid is passed by value to avoid side effects, please don't re-add & -void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, void (*callback)(LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), void *user_data, BOOL is_priority) +void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, BOOL is_priority) { lldebugs << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl; @@ -425,31 +454,9 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo return; } + if (findInVFSAndInvokeCallback(mStaticVFS,uuid,type,callback,user_data)) { - // Try in static VFS first. - BOOL exists = mStaticVFS->getExists(uuid, type); - //exists = false; - if (exists) - { - LLVFile file(mStaticVFS, uuid, type); - U32 size = exists ? file.getSize() : 0; - if (size>0) - { - // we've already got the file - // theoretically, partial files w/o a pending request shouldn't happen - // unless there's a weird error - if (callback) - { - callback(mStaticVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); - } - return; - } - else - { - llwarns << "Asset vfile " << uuid << ":" << type - << " found in static VFS with bad size " << file.getSize() << ", ignoring" << llendl; - } - } + return; } BOOL exists = mVFS->getExists(uuid, type); @@ -645,6 +652,11 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen return; } + if (findInVFSAndInvokeCallback(mStaticVFS,asset_id,atype,callback,user_data)) + { + return; + } + BOOL exists = mVFS->getExists(asset_id, atype); LLVFile file(mVFS, asset_id, atype); U32 size = exists ? file.getSize() : 0; @@ -776,6 +788,12 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age if(asset_id.notNull()) { + // Try static VFS first. + if (findInVFSAndInvokeCallback(mStaticVFS, asset_id, atype, callback, user_data)) + { + return; + } + exists = mVFS->getExists(asset_id, atype); LLVFile file(mVFS, asset_id, atype); size = exists ? file.getSize() : 0; -- cgit v1.2.3 From 695e4bc17126baa282c7f27e8ac9ef1c3323fa77 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 19 Apr 2010 10:00:06 -0400 Subject: For EXT-6809 - search static VFS for all asset types --- indra/llmessage/llassetstorage.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llmessage/llassetstorage.cpp') diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index e65a488098..f8b929769d 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -418,8 +418,8 @@ bool LLAssetStorage::findInVFSAndInvokeCallback(LLVFS *vfs, const LLUUID& uuid, if (callback) { callback(vfs, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); - return true; } + return true; } else { @@ -454,6 +454,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL return; } + // Try static VFS first. if (findInVFSAndInvokeCallback(mStaticVFS,uuid,type,callback,user_data)) { return; @@ -652,6 +653,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen return; } + // Try static VFS first. if (findInVFSAndInvokeCallback(mStaticVFS,asset_id,atype,callback,user_data)) { return; -- cgit v1.2.3 From aa5e494e0cf1242dcd35725576667ab1a935363a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 19 Apr 2010 13:52:59 -0400 Subject: For EXT-6809 - fixes suggested by Nyx code review --- indra/llmessage/llassetstorage.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'indra/llmessage/llassetstorage.cpp') diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index a35ea488b4..20d71c6903 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -401,30 +401,27 @@ BOOL LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType return mStaticVFS->getExists(uuid, type) || mVFS->getExists(uuid, type); } -bool LLAssetStorage::findInVFSAndInvokeCallback(LLVFS *vfs, const LLUUID& uuid, LLAssetType::EType type, - LLGetAssetCallback callback, void *user_data) +bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type, + LLGetAssetCallback callback, void *user_data) { - // Try in static VFS first. - BOOL exists = vfs->getExists(uuid, type); + BOOL exists = mStaticVFS->getExists(uuid, type); if (exists) { - LLVFile file(vfs, uuid, type); + LLVFile file(mStaticVFS, uuid, type); U32 size = exists ? file.getSize() : 0; if (size>0) { // we've already got the file - // theoretically, partial files w/o a pending request shouldn't happen - // unless there's a weird error if (callback) { - callback(vfs, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); + callback(mStaticVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); } return true; } else { llwarns << "Asset vfile " << uuid << ":" << type - << " found with bad size " << file.getSize() << ", ignoring" << llendl; + << " found in static cache with bad size " << file.getSize() << ", ignoring" << llendl; } } return false; @@ -457,7 +454,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL } // Try static VFS first. - if (findInVFSAndInvokeCallback(mStaticVFS,uuid,type,callback,user_data)) + if (findInStaticVFSAndInvokeCallback(uuid,type,callback,user_data)) { return; } @@ -660,7 +657,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen } // Try static VFS first. - if (findInVFSAndInvokeCallback(mStaticVFS,asset_id,atype,callback,user_data)) + if (findInStaticVFSAndInvokeCallback(asset_id,atype,callback,user_data)) { return; } @@ -797,7 +794,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age if(asset_id.notNull()) { // Try static VFS first. - if (findInVFSAndInvokeCallback(mStaticVFS, asset_id, atype, callback, user_data)) + if (findInStaticVFSAndInvokeCallback( asset_id, atype, callback, user_data)) { return; } -- cgit v1.2.3