From f3830dbfa662847d2ed74e5f55c974ffefc92a84 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Tue, 9 Feb 2010 21:17:15 -0600 Subject: Ported some asset storage changes from Snowglobe. --- linden/indra/llmessage/llassetstorage.cpp | 42 +++++++++++++++---------------- linden/indra/llmessage/llassetstorage.h | 11 +++++++- 2 files changed, 31 insertions(+), 22 deletions(-) (limited to 'linden') diff --git a/linden/indra/llmessage/llassetstorage.cpp b/linden/indra/llmessage/llassetstorage.cpp index 0fe24eb..16a96b7 100644 --- a/linden/indra/llmessage/llassetstorage.cpp +++ b/linden/indra/llmessage/llassetstorage.cpp @@ -64,6 +64,9 @@ const LLUUID CATEGORIZE_LOST_AND_FOUND_ID(std::string("00000000-0000-0000-0000-0 const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds +LLTempAssetStorage::~LLTempAssetStorage() +{ +} ///---------------------------------------------------------------------------- /// LLAssetInfo @@ -523,19 +526,16 @@ void LLAssetStorage::downloadCompleteCallback( S32 result, const LLUUID& file_id, LLAssetType::EType file_type, - void* callback_parm_req, LLExtStat ext_status) + void* user_data, LLExtStat ext_status) { lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id << "," << LLAssetType::lookup(file_type) << llendl; - - // be careful! req may be a ptr to memory already freed (a timeout does this) - LLAssetRequest* req = (LLAssetRequest*)callback_parm_req; + LLAssetRequest* req = (LLAssetRequest*)user_data; if(!req) { llwarns << "LLAssetStorage::downloadCompleteCallback called without" "a valid request." << llendl; - // we can live with a null pointer, we're not allowed to deref the ptr anyway (see above) - // return; + return; } if (!gAssetStorage) { @@ -559,7 +559,7 @@ void LLAssetStorage::downloadCompleteCallback( if (LL_ERR_NOERR == result) { // we might have gotten a zero-size file - LLVFile vfile(gAssetStorage->mVFS, file_id, file_type); + LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType()); if (vfile.getSize() <= 0) { llwarns << "downloadCompleteCallback has non-existent or zero-size asset " << req->getUUID() << llendl; @@ -578,7 +578,7 @@ void LLAssetStorage::downloadCompleteCallback( { request_list_t::iterator curiter = iter++; LLAssetRequest* tmp = *curiter; - if ((tmp->getUUID() == file_id) && (tmp->getType() == file_type)) + if ((tmp->getUUID() == file_id) && (tmp->getType()== file_type)) { requests.push_front(tmp); iter = gAssetStorage->mPendingDownloads.erase(curiter); @@ -591,7 +591,7 @@ void LLAssetStorage::downloadCompleteCallback( LLAssetRequest* tmp = *curiter; if (tmp->mDownCallback) { - tmp->mDownCallback(gAssetStorage->mVFS, tmp->getUUID(), tmp->getType(), tmp->mUserData, result, ext_status); + tmp->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), tmp->mUserData, result, ext_status); } delete tmp; } @@ -687,10 +687,10 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback( S32 result, const LLUUID& file_id, LLAssetType::EType file_type, - void* callback_parm_req, + void* user_data, LLExtStat ext_status) { - LLEstateAssetRequest *req = (LLEstateAssetRequest*)callback_parm_req; + LLEstateAssetRequest *req = (LLEstateAssetRequest*)user_data; if(!req) { llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called" @@ -704,10 +704,12 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback( return; } + req->setUUID(file_id); + req->setType(file_type); if (LL_ERR_NOERR == result) { // we might have gotten a zero-size file - LLVFile vfile(gAssetStorage->mVFS, file_id, file_type); + LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getAType()); if (vfile.getSize() <= 0) { llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl; @@ -717,9 +719,7 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback( } } - req->mDownCallback(gAssetStorage->mVFS, file_id, file_type, req->mUserData, result, ext_status); - - delete req; + req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getAType(), req->mUserData, result, ext_status); } void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id, @@ -824,10 +824,10 @@ void LLAssetStorage::downloadInvItemCompleteCallback( S32 result, const LLUUID& file_id, LLAssetType::EType file_type, - void* callback_parm_req, + void* user_data, LLExtStat ext_status) { - LLInvItemRequest *req = (LLInvItemRequest*)callback_parm_req; + LLInvItemRequest *req = (LLInvItemRequest*)user_data; if(!req) { llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called" @@ -840,10 +840,12 @@ void LLAssetStorage::downloadInvItemCompleteCallback( return; } + req->setUUID(file_id); + req->setType(file_type); if (LL_ERR_NOERR == result) { // we might have gotten a zero-size file - LLVFile vfile(gAssetStorage->mVFS, file_id, file_type); + LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType()); if (vfile.getSize() <= 0) { llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl; @@ -853,9 +855,7 @@ void LLAssetStorage::downloadInvItemCompleteCallback( } } - req->mDownCallback(gAssetStorage->mVFS, file_id, file_type, req->mUserData, result, ext_status); - - delete req; + req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), req->mUserData, result, ext_status); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/linden/indra/llmessage/llassetstorage.h b/linden/indra/llmessage/llassetstorage.h index f01ee6a..c094ef4 100644 --- a/linden/indra/llmessage/llassetstorage.h +++ b/linden/indra/llmessage/llassetstorage.h @@ -204,7 +204,16 @@ typedef std::map toxic_asset_map_t; typedef void (*LLGetAssetCallback)(LLVFS *vfs, const LLUUID &asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status); -class LLAssetStorage +class LLTempAssetStorage +{ +public: + virtual ~LLTempAssetStorage() =0; + virtual void addTempAssetData(const LLUUID& asset_id, + const LLUUID& agent_id, + const std::string& host_name) = 0; +}; + +class LLAssetStorage : public LLTempAssetStorage { public: // VFS member is public because static child methods need it :( -- cgit v1.1