Http asset fetching.
This commit is contained in:
@@ -58,10 +58,6 @@ 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
|
||||
///----------------------------------------------------------------------------
|
||||
@@ -157,25 +153,44 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv )
|
||||
/// LLAssetRequest
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
LLAssetRequest::LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType type)
|
||||
: mUUID(uuid),
|
||||
mType(type),
|
||||
mDownCallback( NULL ),
|
||||
mUpCallback( NULL ),
|
||||
mInfoCallback( NULL ),
|
||||
mUserData( NULL ),
|
||||
mHost(),
|
||||
mIsTemp( FALSE ),
|
||||
mIsLocal(FALSE),
|
||||
mIsUserWaiting(FALSE),
|
||||
mTimeout(LL_ASSET_STORAGE_TIMEOUT),
|
||||
mIsPriority(FALSE),
|
||||
mDataSentInFirstPacket(FALSE),
|
||||
mDataIsInVFS( FALSE )
|
||||
LLBaseDownloadRequest::LLBaseDownloadRequest(const LLUUID &uuid, const LLAssetType::EType type)
|
||||
: mUUID(uuid),
|
||||
mType(type),
|
||||
mDownCallback(NULL),
|
||||
mUserData(NULL),
|
||||
mHost(),
|
||||
mIsTemp(FALSE),
|
||||
mIsPriority(FALSE),
|
||||
mDataSentInFirstPacket(FALSE),
|
||||
mDataIsInVFS(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.
|
||||
mTime = LLMessageSystem::getMessageTimeSeconds(TRUE);
|
||||
}
|
||||
|
||||
// virtual
|
||||
LLBaseDownloadRequest::~LLBaseDownloadRequest()
|
||||
{
|
||||
}
|
||||
// virtual
|
||||
LLBaseDownloadRequest* LLBaseDownloadRequest::getCopy()
|
||||
{
|
||||
return new LLBaseDownloadRequest(*this);
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// LLAssetRequest
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
LLAssetRequest::LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType type)
|
||||
: LLBaseDownloadRequest(uuid, type),
|
||||
mUpCallback( NULL ),
|
||||
mInfoCallback( NULL ),
|
||||
mIsLocal(FALSE),
|
||||
mIsUserWaiting(FALSE),
|
||||
mTimeout(LL_ASSET_STORAGE_TIMEOUT)
|
||||
{
|
||||
// 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.
|
||||
mTime = LLMessageSystem::getMessageTimeSeconds(TRUE);
|
||||
}
|
||||
|
||||
// virtual
|
||||
@@ -213,56 +228,50 @@ LLSD LLAssetRequest::getFullDetails() const
|
||||
return sd;
|
||||
}
|
||||
|
||||
LLBaseDownloadRequest* LLAssetRequest::getCopy()
|
||||
{
|
||||
return new LLAssetRequest(*this);
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// LLInvItemRequest
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
LLInvItemRequest::LLInvItemRequest(const LLUUID &uuid, const LLAssetType::EType type)
|
||||
: mUUID(uuid),
|
||||
mType(type),
|
||||
mDownCallback( NULL ),
|
||||
mUserData( NULL ),
|
||||
mHost(),
|
||||
mIsTemp( FALSE ),
|
||||
mIsPriority(FALSE),
|
||||
mDataSentInFirstPacket(FALSE),
|
||||
mDataIsInVFS( FALSE )
|
||||
: LLBaseDownloadRequest(uuid, type)
|
||||
{
|
||||
// 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.
|
||||
mTime = LLMessageSystem::getMessageTimeSeconds(TRUE);
|
||||
}
|
||||
|
||||
// virtual
|
||||
LLInvItemRequest::~LLInvItemRequest()
|
||||
{
|
||||
}
|
||||
|
||||
LLBaseDownloadRequest* LLInvItemRequest::getCopy()
|
||||
{
|
||||
return new LLInvItemRequest(*this);
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// LLEstateAssetRequest
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
LLEstateAssetRequest::LLEstateAssetRequest(const LLUUID &uuid, const LLAssetType::EType atype,
|
||||
EstateAssetType etype)
|
||||
: mUUID(uuid),
|
||||
mAType(atype),
|
||||
mEstateAssetType(etype),
|
||||
mDownCallback( NULL ),
|
||||
mUserData( NULL ),
|
||||
mHost(),
|
||||
mIsTemp( FALSE ),
|
||||
mIsPriority(FALSE),
|
||||
mDataSentInFirstPacket(FALSE),
|
||||
mDataIsInVFS( FALSE )
|
||||
EstateAssetType etype)
|
||||
: LLBaseDownloadRequest(uuid, atype),
|
||||
mEstateAssetType(etype)
|
||||
{
|
||||
// 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.
|
||||
mTime = LLMessageSystem::getMessageTimeSeconds(TRUE);
|
||||
}
|
||||
|
||||
// Virtual
|
||||
LLEstateAssetRequest::~LLEstateAssetRequest()
|
||||
{
|
||||
}
|
||||
|
||||
LLBaseDownloadRequest* LLEstateAssetRequest::getCopy()
|
||||
{
|
||||
return new LLEstateAssetRequest(*this);
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// LLAssetStorage
|
||||
@@ -356,7 +365,7 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error)
|
||||
|| ((RT_DOWNLOAD == rt)
|
||||
&& LL_ASSET_STORAGE_TIMEOUT < (mt_secs - tmp->mTime)))
|
||||
{
|
||||
LL_WARNS() << "Asset " << getRequestName((ERequestType)rt) << " request "
|
||||
LL_WARNS("AssetStorage") << "Asset " << getRequestName((ERequestType)rt) << " request "
|
||||
<< (all ? "aborted" : "timed out") << " for "
|
||||
<< tmp->getUUID() << "."
|
||||
<< LLAssetType::lookup(tmp->getType()) << LL_ENDL;
|
||||
@@ -420,7 +429,7 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "Asset vfile " << uuid << ":" << type
|
||||
LL_WARNS("AssetStorage") << "Asset vfile " << uuid << ":" << type
|
||||
<< " found in static cache with bad size " << file.getSize() << ", ignoring" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
@@ -432,7 +441,11 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// IW - uuid is passed by value to avoid side effects, please don't re-add &
|
||||
void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, BOOL is_priority)
|
||||
void LLAssetStorage::getAssetData(const LLUUID uuid,
|
||||
LLAssetType::EType type,
|
||||
LLGetAssetCallback callback,
|
||||
void *user_data,
|
||||
BOOL is_priority)
|
||||
{
|
||||
LL_DEBUGS("AssetStorage") << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << LL_ENDL;
|
||||
|
||||
@@ -504,7 +517,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
|
||||
{
|
||||
if (exists)
|
||||
{
|
||||
LL_WARNS() << "Asset vfile " << uuid << ":" << type << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "Asset vfile " << uuid << ":" << type << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
|
||||
file.remove();
|
||||
}
|
||||
|
||||
@@ -520,7 +533,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
|
||||
if (callback == tmp->mDownCallback && user_data == tmp->mUserData)
|
||||
{
|
||||
// this is a duplicate from the same subsystem - throw it away
|
||||
LL_WARNS() << "Discarding duplicate request for asset " << uuid
|
||||
LL_WARNS("AssetStorage") << "Discarding duplicate request for asset " << uuid
|
||||
<< "." << LLAssetType::lookup(type) << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
@@ -542,107 +555,11 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// *NOTE: Logic here is replicated in LLViewerAssetStorage::_queueDataRequest.
|
||||
// Changes here may need to be replicated in the viewer's derived class.
|
||||
//
|
||||
void LLAssetStorage::_queueDataRequest(const LLUUID& uuid, LLAssetType::EType atype,
|
||||
LLGetAssetCallback callback,
|
||||
void *user_data, BOOL duplicate,
|
||||
BOOL is_priority)
|
||||
{
|
||||
if (mUpstreamHost.isOk())
|
||||
{
|
||||
// stash the callback info so we can find it after we get the response message
|
||||
LLAssetRequest *req = new LLAssetRequest(uuid, atype);
|
||||
req->mDownCallback = callback;
|
||||
req->mUserData = user_data;
|
||||
req->mIsPriority = is_priority;
|
||||
|
||||
mPendingDownloads.push_back(req);
|
||||
|
||||
if (!duplicate)
|
||||
{
|
||||
// send request message to our upstream data provider
|
||||
// Create a new asset transfer.
|
||||
LLTransferSourceParamsAsset spa;
|
||||
spa.setAsset(uuid, atype);
|
||||
|
||||
// Set our destination file, and the completion callback.
|
||||
LLTransferTargetParamsVFile tpvf;
|
||||
tpvf.setAsset(uuid, atype);
|
||||
tpvf.setCallback(downloadCompleteCallback, req);
|
||||
|
||||
//LL_INFOS() << "Starting transfer for " << uuid << LL_ENDL;
|
||||
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(mUpstreamHost, LLTCT_ASSET);
|
||||
ttcp->requestTransfer(spa, tpvf, 100.f + (is_priority ? 1.f : 0.f));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// uh-oh, we shouldn't have gotten here
|
||||
LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL;
|
||||
if (callback)
|
||||
{
|
||||
callback(mVFS, uuid, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLAssetStorage::downloadCompleteCallback(
|
||||
S32 result,
|
||||
const LLUUID& file_id,
|
||||
LLAssetType::EType file_type,
|
||||
void* user_data, LLExtStat ext_status)
|
||||
{
|
||||
LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << LL_ENDL;
|
||||
|
||||
LL_DEBUGS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback() for " << file_id
|
||||
<< "," << LLAssetType::lookup(file_type) << LL_ENDL;
|
||||
LLAssetRequest* req = (LLAssetRequest*)user_data;
|
||||
if(!req)
|
||||
{
|
||||
LL_WARNS() << "LLAssetStorage::downloadCompleteCallback called without"
|
||||
"a valid request." << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
if (!gAssetStorage)
|
||||
{
|
||||
LL_WARNS() << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
// Inefficient since we're doing a find through a list that may have thousands of elements.
|
||||
// This is due for refactoring; we will probably change mPendingDownloads into a set.
|
||||
request_list_t::iterator download_iter = std::find(gAssetStorage->mPendingDownloads.begin(),
|
||||
gAssetStorage->mPendingDownloads.end(),
|
||||
req);
|
||||
// If the LLAssetRequest doesn't exist in the downloads queue, then it either has already been deleted
|
||||
// by _cleanupRequests, or it's a transfer.
|
||||
if (download_iter != gAssetStorage->mPendingDownloads.end())
|
||||
{
|
||||
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, req->getUUID(), req->getType());
|
||||
if (vfile.getSize() <= 0)
|
||||
{
|
||||
LL_WARNS() << "downloadCompleteCallback has non-existent or zero-size asset " << req->getUUID() << LL_ENDL;
|
||||
|
||||
result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
|
||||
vfile.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// we will be deleting elements of mPendingDownloads which req might be part of, save id and type for reference
|
||||
LLUUID callback_id = req->getUUID();
|
||||
LLAssetType::EType callback_type = req->getType();
|
||||
|
||||
// static
|
||||
void LLAssetStorage::removeAndCallbackPendingDownloads(const LLUUID& file_id, LLAssetType::EType file_type,
|
||||
const LLUUID& callback_id, LLAssetType::EType callback_type,
|
||||
S32 result_code, LLExtStat ext_status)
|
||||
{
|
||||
// find and callback ALL pending requests for this UUID
|
||||
// SJB: We process the callbacks in reverse order, I do not know if this is important,
|
||||
// but I didn't want to mess with it.
|
||||
@@ -665,15 +582,82 @@ void LLAssetStorage::downloadCompleteCallback(
|
||||
LLAssetRequest* tmp = *curiter;
|
||||
if (tmp->mDownCallback)
|
||||
{
|
||||
tmp->mDownCallback(gAssetStorage->mVFS, callback_id, callback_type, tmp->mUserData, result, ext_status);
|
||||
tmp->mDownCallback(gAssetStorage->mVFS, callback_id, callback_type, tmp->mUserData, result_code, ext_status);
|
||||
}
|
||||
delete tmp;
|
||||
}
|
||||
}
|
||||
|
||||
void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id,
|
||||
const LLUUID &asset_id, LLAssetType::EType atype, EstateAssetType etype,
|
||||
LLGetAssetCallback callback, void *user_data, BOOL is_priority)
|
||||
void LLAssetStorage::downloadCompleteCallback(
|
||||
S32 result,
|
||||
const LLUUID& file_id,
|
||||
LLAssetType::EType file_type,
|
||||
LLBaseDownloadRequest* user_data,
|
||||
LLExtStat ext_status)
|
||||
{
|
||||
LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << LL_ENDL;
|
||||
|
||||
LL_DEBUGS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback() for " << file_id
|
||||
<< "," << LLAssetType::lookup(file_type) << LL_ENDL;
|
||||
LLAssetRequest* req = (LLAssetRequest*)user_data;
|
||||
if(!req)
|
||||
{
|
||||
LL_WARNS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback called without"
|
||||
"a valid request." << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
if (!gAssetStorage)
|
||||
{
|
||||
LL_WARNS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
LLUUID callback_id;
|
||||
LLAssetType::EType callback_type;
|
||||
|
||||
// Inefficient since we're doing a find through a list that may have thousands of elements.
|
||||
// This is due for refactoring; we will probably change mPendingDownloads into a set.
|
||||
// use findRequest instead. Legacy asset download gets a COPY of the request, thus pointer comparisons wont work here.
|
||||
LLAssetRequest* download_req = LLAssetStorage::findRequest(&gAssetStorage->mPendingDownloads, req->getType(), req->getUUID() );
|
||||
|
||||
if (download_req)
|
||||
{
|
||||
callback_id = file_id;
|
||||
callback_type = file_type;
|
||||
}
|
||||
else
|
||||
{
|
||||
// either has already been deleted by _cleanupRequests or it's a transfer.
|
||||
callback_id = req->getUUID();
|
||||
callback_type = req->getType();
|
||||
}
|
||||
|
||||
if (LL_ERR_NOERR == result)
|
||||
{
|
||||
// we might have gotten a zero-size file
|
||||
LLVFile vfile(gAssetStorage->mVFS, callback_id, callback_type);
|
||||
if (vfile.getSize() <= 0)
|
||||
{
|
||||
LL_WARNS("AssetStorage") << "downloadCompleteCallback has non-existent or zero-size asset " << callback_id << LL_ENDL;
|
||||
|
||||
result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
|
||||
vfile.remove();
|
||||
}
|
||||
}
|
||||
|
||||
removeAndCallbackPendingDownloads(file_id, file_type, callback_id, callback_type, ext_status, result);
|
||||
}
|
||||
|
||||
void LLAssetStorage::getEstateAsset(
|
||||
const LLHost &object_sim,
|
||||
const LLUUID &agent_id,
|
||||
const LLUUID &session_id,
|
||||
const LLUUID &asset_id,
|
||||
LLAssetType::EType atype,
|
||||
EstateAssetType etype,
|
||||
LLGetAssetCallback callback,
|
||||
void *user_data,
|
||||
BOOL is_priority)
|
||||
{
|
||||
LL_DEBUGS() << "LLAssetStorage::getEstateAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << ", estatetype " << etype << LL_ENDL;
|
||||
|
||||
@@ -714,7 +698,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
|
||||
{
|
||||
if (exists)
|
||||
{
|
||||
LL_WARNS() << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
|
||||
file.remove();
|
||||
}
|
||||
|
||||
@@ -731,10 +715,10 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
|
||||
if (source_host.isOk())
|
||||
{
|
||||
// stash the callback info so we can find it after we get the response message
|
||||
LLEstateAssetRequest *req = new LLEstateAssetRequest(asset_id, atype, etype);
|
||||
req->mDownCallback = callback;
|
||||
req->mUserData = user_data;
|
||||
req->mIsPriority = is_priority;
|
||||
LLEstateAssetRequest req(asset_id, atype, etype);
|
||||
req.mDownCallback = callback;
|
||||
req.mUserData = user_data;
|
||||
req.mIsPriority = is_priority;
|
||||
|
||||
// send request message to our upstream data provider
|
||||
// Create a new asset transfer.
|
||||
@@ -754,7 +738,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
|
||||
else
|
||||
{
|
||||
// uh-oh, we shouldn't have gotten here
|
||||
LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL;
|
||||
if (callback)
|
||||
{
|
||||
callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
|
||||
@@ -767,19 +751,19 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
|
||||
S32 result,
|
||||
const LLUUID& file_id,
|
||||
LLAssetType::EType file_type,
|
||||
void* user_data,
|
||||
LLBaseDownloadRequest* user_data,
|
||||
LLExtStat ext_status)
|
||||
{
|
||||
LLEstateAssetRequest *req = (LLEstateAssetRequest*)user_data;
|
||||
if(!req)
|
||||
{
|
||||
LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
|
||||
LL_WARNS("AssetStorage") << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
|
||||
" without a valid request." << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
if (!gAssetStorage)
|
||||
{
|
||||
LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
|
||||
LL_WARNS("AssetStorage") << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
|
||||
" without any asset system, aborting!" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
@@ -792,7 +776,7 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
|
||||
LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getAType());
|
||||
if (vfile.getSize() <= 0)
|
||||
{
|
||||
LL_WARNS() << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL;
|
||||
|
||||
result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
|
||||
vfile.remove();
|
||||
@@ -802,26 +786,21 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
|
||||
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,
|
||||
const LLUUID &owner_id, const LLUUID &task_id, const LLUUID &item_id,
|
||||
const LLUUID &asset_id, LLAssetType::EType atype,
|
||||
LLGetAssetCallback callback, void *user_data, BOOL is_priority)
|
||||
void LLAssetStorage::getInvItemAsset(
|
||||
const LLHost &object_sim,
|
||||
const LLUUID &agent_id,
|
||||
const LLUUID &session_id,
|
||||
const LLUUID &owner_id,
|
||||
const LLUUID &task_id,
|
||||
const LLUUID &item_id,
|
||||
const LLUUID &asset_id,
|
||||
LLAssetType::EType atype,
|
||||
LLGetAssetCallback callback,
|
||||
void *user_data,
|
||||
BOOL is_priority)
|
||||
{
|
||||
LL_DEBUGS() << "LLAssetStorage::getInvItemAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << LL_ENDL;
|
||||
|
||||
//
|
||||
// Probably will get rid of this early out?
|
||||
//
|
||||
//if (asset_id.isNull())
|
||||
//{
|
||||
// // Special case early out for NULL uuid
|
||||
// if (callback)
|
||||
// {
|
||||
// callback(mVFS, asset_id, atype, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE);
|
||||
// }
|
||||
// return;
|
||||
//}
|
||||
|
||||
bool exists = false;
|
||||
U32 size = 0;
|
||||
|
||||
@@ -838,7 +817,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
|
||||
size = exists ? file.getSize() : 0;
|
||||
if(exists && size < 1)
|
||||
{
|
||||
LL_WARNS() << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
|
||||
file.remove();
|
||||
}
|
||||
|
||||
@@ -870,10 +849,10 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
|
||||
if (source_host.isOk())
|
||||
{
|
||||
// stash the callback info so we can find it after we get the response message
|
||||
LLInvItemRequest *req = new LLInvItemRequest(asset_id, atype);
|
||||
req->mDownCallback = callback;
|
||||
req->mUserData = user_data;
|
||||
req->mIsPriority = is_priority;
|
||||
LLInvItemRequest req(asset_id, atype);
|
||||
req.mDownCallback = callback;
|
||||
req.mUserData = user_data;
|
||||
req.mIsPriority = is_priority;
|
||||
|
||||
// send request message to our upstream data provider
|
||||
// Create a new asset transfer.
|
||||
@@ -896,7 +875,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
|
||||
else
|
||||
{
|
||||
// uh-oh, we shouldn't have gotten here
|
||||
LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL;
|
||||
if (callback)
|
||||
{
|
||||
callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
|
||||
@@ -910,19 +889,19 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
|
||||
S32 result,
|
||||
const LLUUID& file_id,
|
||||
LLAssetType::EType file_type,
|
||||
void* user_data,
|
||||
LLBaseDownloadRequest* user_data,
|
||||
LLExtStat ext_status)
|
||||
{
|
||||
LLInvItemRequest *req = (LLInvItemRequest*)user_data;
|
||||
if(!req)
|
||||
{
|
||||
LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
|
||||
LL_WARNS("AssetStorage") << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
|
||||
" without a valid request." << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
if (!gAssetStorage)
|
||||
{
|
||||
LL_WARNS() << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -934,7 +913,7 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
|
||||
LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType());
|
||||
if (vfile.getSize() <= 0)
|
||||
{
|
||||
LL_WARNS() << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL;
|
||||
|
||||
result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
|
||||
vfile.remove();
|
||||
@@ -949,11 +928,15 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// static
|
||||
void LLAssetStorage::uploadCompleteCallback(const LLUUID& uuid, void *user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed)
|
||||
void LLAssetStorage::uploadCompleteCallback(
|
||||
const LLUUID& uuid,
|
||||
void *user_data,
|
||||
S32 result,
|
||||
LLExtStat ext_status) // StoreAssetData callback (fixed)
|
||||
{
|
||||
if (!gAssetStorage)
|
||||
{
|
||||
LL_WARNS() << "LLAssetStorage::uploadCompleteCallback has no gAssetStorage!" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "LLAssetStorage::uploadCompleteCallback has no gAssetStorage!" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
LLAssetRequest *req = (LLAssetRequest *)user_data;
|
||||
@@ -961,7 +944,7 @@ void LLAssetStorage::uploadCompleteCallback(const LLUUID& uuid, void *user_data,
|
||||
|
||||
if (result)
|
||||
{
|
||||
LL_WARNS() << "LLAssetStorage::uploadCompleteCallback " << result << ":" << getErrorString(result) << " trying to upload file to upstream provider" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "LLAssetStorage::uploadCompleteCallback " << result << ":" << getErrorString(result) << " trying to upload file to upstream provider" << LL_ENDL;
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
@@ -1043,7 +1026,7 @@ LLAssetStorage::request_list_t* LLAssetStorage::getRequestList(LLAssetStorage::E
|
||||
case RT_LOCALUPLOAD:
|
||||
return &mPendingLocalUploads;
|
||||
default:
|
||||
LL_WARNS() << "Unable to find request list for request type '" << rt << "'" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "Unable to find request list for request type '" << rt << "'" << LL_ENDL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1059,7 +1042,7 @@ const LLAssetStorage::request_list_t* LLAssetStorage::getRequestList(LLAssetStor
|
||||
case RT_LOCALUPLOAD:
|
||||
return &mPendingLocalUploads;
|
||||
default:
|
||||
LL_WARNS() << "Unable to find request list for request type '" << rt << "'" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "Unable to find request list for request type '" << rt << "'" << LL_ENDL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1076,7 +1059,7 @@ std::string LLAssetStorage::getRequestName(LLAssetStorage::ERequestType rt)
|
||||
case RT_LOCALUPLOAD:
|
||||
return "localupload";
|
||||
default:
|
||||
LL_WARNS() << "Unable to find request name for request type '" << rt << "'" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "Unable to find request name for request type '" << rt << "'" << LL_ENDL;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -1307,9 +1290,15 @@ const char* LLAssetStorage::getErrorString(S32 status)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, void (*callback)(const char*, const LLUUID&, void *, S32, LLExtStat), void *user_data, BOOL is_priority)
|
||||
void LLAssetStorage::getAssetData(const LLUUID uuid,
|
||||
LLAssetType::EType type,
|
||||
void (*callback)(const char*,
|
||||
const LLUUID&,
|
||||
void *,
|
||||
S32,
|
||||
LLExtStat),
|
||||
void *user_data,
|
||||
BOOL is_priority)
|
||||
{
|
||||
// check for duplicates here, since we're about to fool the normal duplicate checker
|
||||
for (request_list_t::iterator iter = mPendingDownloads.begin();
|
||||
@@ -1339,7 +1328,12 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo
|
||||
}
|
||||
|
||||
// static
|
||||
void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, void *user_data, S32 status, LLExtStat ext_status)
|
||||
void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs,
|
||||
const LLUUID &uuid,
|
||||
LLAssetType::EType type,
|
||||
void *user_data,
|
||||
S32 status,
|
||||
LLExtStat ext_status)
|
||||
{
|
||||
LLLegacyAssetRequest *legacy = (LLLegacyAssetRequest *)user_data;
|
||||
std::string filename;
|
||||
@@ -1383,78 +1377,6 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAss
|
||||
delete legacy;
|
||||
}
|
||||
|
||||
// this is overridden on the viewer and the sim, so it doesn't really do anything
|
||||
// virtual
|
||||
void LLAssetStorage::storeAssetData(
|
||||
const LLTransactionID& tid,
|
||||
LLAssetType::EType asset_type,
|
||||
LLStoreAssetCallback callback,
|
||||
void* user_data,
|
||||
bool temp_file,
|
||||
bool is_priority,
|
||||
bool store_local,
|
||||
bool user_waiting,
|
||||
F64Seconds timeout)
|
||||
{
|
||||
LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL;
|
||||
// LLAssetStorage metric: Virtual base call
|
||||
reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 1" );
|
||||
}
|
||||
|
||||
// virtual
|
||||
// this does nothing, viewer and sim both override this.
|
||||
void LLAssetStorage::storeAssetData(
|
||||
const LLUUID& asset_id,
|
||||
LLAssetType::EType asset_type,
|
||||
LLStoreAssetCallback callback,
|
||||
void* user_data,
|
||||
bool temp_file ,
|
||||
bool is_priority,
|
||||
bool store_local,
|
||||
const LLUUID& requesting_agent_id,
|
||||
bool user_waiting,
|
||||
F64Seconds timeout)
|
||||
{
|
||||
LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL;
|
||||
// LLAssetStorage metric: Virtual base call
|
||||
reportMetric( asset_id, asset_type, LLStringUtil::null, requesting_agent_id, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 2" );
|
||||
}
|
||||
|
||||
// virtual
|
||||
// this does nothing, viewer and sim both override this.
|
||||
void LLAssetStorage::storeAssetData(
|
||||
const std::string& filename,
|
||||
const LLUUID& asset_id,
|
||||
LLAssetType::EType asset_type,
|
||||
LLStoreAssetCallback callback,
|
||||
void* user_data,
|
||||
bool temp_file,
|
||||
bool is_priority,
|
||||
bool user_waiting,
|
||||
F64Seconds timeout)
|
||||
{
|
||||
LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL;
|
||||
// LLAssetStorage metric: Virtual base call
|
||||
reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 3" );
|
||||
}
|
||||
|
||||
// virtual
|
||||
// this does nothing, viewer and sim both override this.
|
||||
void LLAssetStorage::storeAssetData(
|
||||
const std::string& filename,
|
||||
const LLTransactionID &transactoin_id,
|
||||
LLAssetType::EType asset_type,
|
||||
LLStoreAssetCallback callback,
|
||||
void* user_data,
|
||||
bool temp_file,
|
||||
bool is_priority,
|
||||
bool user_waiting,
|
||||
F64Seconds timeout)
|
||||
{
|
||||
LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL;
|
||||
// LLAssetStorage metric: Virtual base call
|
||||
reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 4" );
|
||||
}
|
||||
|
||||
// static
|
||||
void LLAssetStorage::legacyStoreDataCallback(const LLUUID &uuid, void *user_data, S32 status, LLExtStat ext_status)
|
||||
@@ -1467,38 +1389,6 @@ void LLAssetStorage::legacyStoreDataCallback(const LLUUID &uuid, void *user_data
|
||||
delete legacy;
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLAssetStorage::addTempAssetData(const LLUUID& asset_id, const LLUUID& agent_id, const std::string& host_name)
|
||||
{ }
|
||||
|
||||
// virtual
|
||||
BOOL LLAssetStorage::hasTempAssetData(const LLUUID& texture_id) const
|
||||
{ return FALSE; }
|
||||
|
||||
// virtual
|
||||
std::string LLAssetStorage::getTempAssetHostName(const LLUUID& texture_id) const
|
||||
{ return std::string(); }
|
||||
|
||||
// virtual
|
||||
LLUUID LLAssetStorage::getTempAssetAgentID(const LLUUID& texture_id) const
|
||||
{ return LLUUID::null; }
|
||||
|
||||
// virtual
|
||||
void LLAssetStorage::removeTempAssetData(const LLUUID& asset_id)
|
||||
{ }
|
||||
|
||||
// virtual
|
||||
void LLAssetStorage::removeTempAssetDataByAgentID(const LLUUID& agent_id)
|
||||
{ }
|
||||
|
||||
// virtual
|
||||
void LLAssetStorage::dumpTempAssetData(const LLUUID& avatar_id) const
|
||||
{ }
|
||||
|
||||
// virtual
|
||||
void LLAssetStorage::clearTempAssetData()
|
||||
{ }
|
||||
|
||||
// static
|
||||
void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const std::string& in_filename,
|
||||
const LLUUID& agent_id, S32 asset_size, EMetricResult result,
|
||||
|
||||
@@ -92,18 +92,19 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class LLAssetRequest
|
||||
class LLBaseDownloadRequest
|
||||
{
|
||||
public:
|
||||
LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType at);
|
||||
virtual ~LLAssetRequest();
|
||||
|
||||
LLBaseDownloadRequest(const LLUUID &uuid, const LLAssetType::EType at);
|
||||
virtual ~LLBaseDownloadRequest();
|
||||
|
||||
LLUUID getUUID() const { return mUUID; }
|
||||
LLAssetType::EType getType() const { return mType; }
|
||||
|
||||
void setUUID(const LLUUID& id) { mUUID = id; }
|
||||
void setType(LLAssetType::EType type) { mType = type; }
|
||||
void setTimeout (F64Seconds timeout) { mTimeout = timeout; }
|
||||
|
||||
virtual LLBaseDownloadRequest* getCopy();
|
||||
|
||||
protected:
|
||||
LLUUID mUUID;
|
||||
@@ -111,19 +112,35 @@ protected:
|
||||
|
||||
public:
|
||||
void (*mDownCallback)(LLVFS*, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat);
|
||||
void (*mUpCallback)(const LLUUID&, void *, S32, LLExtStat);
|
||||
void (*mInfoCallback)(LLAssetInfo *, void *, S32);
|
||||
|
||||
|
||||
void *mUserData;
|
||||
LLHost mHost;
|
||||
BOOL mIsTemp;
|
||||
BOOL mIsLocal;
|
||||
BOOL mIsUserWaiting; // We don't want to try forever if a user is waiting for a result.
|
||||
|
||||
F64Seconds mTime; // Message system time
|
||||
F64Seconds mTimeout; // Amount of time before timing out.
|
||||
|
||||
BOOL mIsPriority;
|
||||
BOOL mDataSentInFirstPacket;
|
||||
BOOL mDataIsInVFS;
|
||||
};
|
||||
|
||||
class LLAssetRequest : public LLBaseDownloadRequest
|
||||
{
|
||||
public:
|
||||
LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType at);
|
||||
virtual ~LLAssetRequest();
|
||||
|
||||
void setTimeout(F64Seconds timeout) { mTimeout = timeout; }
|
||||
|
||||
virtual LLBaseDownloadRequest* getCopy();
|
||||
|
||||
void (*mUpCallback)(const LLUUID&, void *, S32, LLExtStat);
|
||||
void (*mInfoCallback)(LLAssetInfo *, void *, S32);
|
||||
|
||||
BOOL mIsLocal;
|
||||
BOOL mIsUserWaiting; // We don't want to try forever if a user is waiting for a result.
|
||||
F64Seconds mTimeout; // Amount of time before timing out.
|
||||
LLUUID mRequestingAgentID; // Only valid for uploads from an agent
|
||||
|
||||
virtual LLSD getTerseDetails() const;
|
||||
@@ -141,63 +158,27 @@ struct ll_asset_request_equal : public std::equal_to<T>
|
||||
};
|
||||
|
||||
|
||||
class LLInvItemRequest
|
||||
class LLInvItemRequest : public LLBaseDownloadRequest
|
||||
{
|
||||
public:
|
||||
LLInvItemRequest(const LLUUID &uuid, const LLAssetType::EType at);
|
||||
virtual ~LLInvItemRequest();
|
||||
|
||||
LLUUID getUUID() const { return mUUID; }
|
||||
LLAssetType::EType getType() const { return mType; }
|
||||
|
||||
void setUUID(const LLUUID& id) { mUUID = id; }
|
||||
void setType(LLAssetType::EType type) { mType = type; }
|
||||
|
||||
protected:
|
||||
LLUUID mUUID;
|
||||
LLAssetType::EType mType;
|
||||
|
||||
public:
|
||||
void (*mDownCallback)(LLVFS*, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat);
|
||||
|
||||
void *mUserData;
|
||||
LLHost mHost;
|
||||
BOOL mIsTemp;
|
||||
F64Seconds mTime; // Message system time
|
||||
BOOL mIsPriority;
|
||||
BOOL mDataSentInFirstPacket;
|
||||
BOOL mDataIsInVFS;
|
||||
|
||||
virtual LLBaseDownloadRequest* getCopy();
|
||||
};
|
||||
|
||||
class LLEstateAssetRequest
|
||||
class LLEstateAssetRequest : public LLBaseDownloadRequest
|
||||
{
|
||||
public:
|
||||
LLEstateAssetRequest(const LLUUID &uuid, const LLAssetType::EType at, EstateAssetType et);
|
||||
virtual ~LLEstateAssetRequest();
|
||||
|
||||
LLUUID getUUID() const { return mUUID; }
|
||||
LLAssetType::EType getAType() const { return mAType; }
|
||||
LLAssetType::EType getAType() const { return mType; }
|
||||
|
||||
void setUUID(const LLUUID& id) { mUUID = id; }
|
||||
void setType(LLAssetType::EType type) { mAType = type; }
|
||||
virtual LLBaseDownloadRequest* getCopy();
|
||||
|
||||
protected:
|
||||
LLUUID mUUID;
|
||||
LLAssetType::EType mAType;
|
||||
EstateAssetType mEstateAssetType;
|
||||
|
||||
public:
|
||||
void (*mDownCallback)(LLVFS*, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat);
|
||||
|
||||
void *mUserData;
|
||||
LLHost mHost;
|
||||
BOOL mIsTemp;
|
||||
F64Seconds mTime; // Message system time
|
||||
BOOL mIsPriority;
|
||||
BOOL mDataSentInFirstPacket;
|
||||
BOOL mDataIsInVFS;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -207,16 +188,8 @@ typedef std::map<LLUUID,U64,lluuid_less> 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 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
|
||||
class LLAssetStorage
|
||||
{
|
||||
public:
|
||||
// VFS member is public because static child methods need it :(
|
||||
@@ -263,12 +236,12 @@ public:
|
||||
return mUpstreamHost.isOk();
|
||||
}
|
||||
|
||||
virtual BOOL hasLocalAsset(const LLUUID &uuid, LLAssetType::EType type);
|
||||
BOOL hasLocalAsset(const LLUUID &uuid, LLAssetType::EType type);
|
||||
|
||||
// public interface methods
|
||||
// note that your callback may get called BEFORE the function returns
|
||||
|
||||
virtual void getAssetData(const LLUUID uuid, LLAssetType::EType atype, LLGetAssetCallback cb, void *user_data, BOOL is_priority = FALSE);
|
||||
void getAssetData(const LLUUID uuid, LLAssetType::EType atype, LLGetAssetCallback cb, void *user_data, BOOL is_priority = FALSE);
|
||||
|
||||
std::vector<LLUUID> mBlackListedAsset;
|
||||
|
||||
@@ -285,25 +258,10 @@ public:
|
||||
bool is_priority = false,
|
||||
bool store_local = false,
|
||||
bool user_waiting= false,
|
||||
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
|
||||
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT) = 0;
|
||||
|
||||
/*
|
||||
* AssetID version
|
||||
* Sim needs both store_local and requesting_agent_id.
|
||||
*/
|
||||
virtual void storeAssetData(
|
||||
const LLUUID& asset_id,
|
||||
LLAssetType::EType asset_type,
|
||||
LLStoreAssetCallback callback,
|
||||
void* user_data,
|
||||
bool temp_file = false,
|
||||
bool is_priority = false,
|
||||
bool store_local = false,
|
||||
const LLUUID& requesting_agent_id = LLUUID::null,
|
||||
bool user_waiting= false,
|
||||
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
|
||||
|
||||
virtual void checkForTimeouts();
|
||||
void checkForTimeouts();
|
||||
|
||||
void getEstateAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id,
|
||||
const LLUUID &asset_id, LLAssetType::EType atype, EstateAssetType etype,
|
||||
@@ -328,15 +286,15 @@ protected:
|
||||
bool findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type,
|
||||
LLGetAssetCallback callback, void *user_data);
|
||||
|
||||
virtual LLSD getPendingDetailsImpl(const request_list_t* requests,
|
||||
LLSD getPendingDetailsImpl(const request_list_t* requests,
|
||||
LLAssetType::EType asset_type,
|
||||
const std::string& detail_prefix) const;
|
||||
|
||||
virtual LLSD getPendingRequestImpl(const request_list_t* requests,
|
||||
LLSD getPendingRequestImpl(const request_list_t* requests,
|
||||
LLAssetType::EType asset_type,
|
||||
const LLUUID& asset_id) const;
|
||||
|
||||
virtual bool deletePendingRequestImpl(request_list_t* requests,
|
||||
bool deletePendingRequestImpl(request_list_t* requests,
|
||||
LLAssetType::EType asset_type,
|
||||
const LLUUID& asset_id);
|
||||
|
||||
@@ -357,35 +315,39 @@ public:
|
||||
S32 getNumPendingLocalUploads();
|
||||
S32 getNumPending(ERequestType rt) const;
|
||||
|
||||
virtual LLSD getPendingDetails(ERequestType rt,
|
||||
LLSD getPendingDetails(ERequestType rt,
|
||||
LLAssetType::EType asset_type,
|
||||
const std::string& detail_prefix) const;
|
||||
|
||||
virtual LLSD getPendingRequest(ERequestType rt,
|
||||
LLSD getPendingRequest(ERequestType rt,
|
||||
LLAssetType::EType asset_type,
|
||||
const LLUUID& asset_id) const;
|
||||
|
||||
virtual bool deletePendingRequest(ERequestType rt,
|
||||
bool deletePendingRequest(ERequestType rt,
|
||||
LLAssetType::EType asset_type,
|
||||
const LLUUID& asset_id);
|
||||
|
||||
|
||||
static void removeAndCallbackPendingDownloads( const LLUUID& file_id, LLAssetType::EType file_type,
|
||||
const LLUUID& callback_id, LLAssetType::EType callback_type,
|
||||
S32 result_code, LLExtStat ext_status);
|
||||
|
||||
// download process callbacks
|
||||
static void downloadCompleteCallback(
|
||||
S32 result,
|
||||
const LLUUID& file_id,
|
||||
LLAssetType::EType file_type,
|
||||
void* user_data, LLExtStat ext_status);
|
||||
LLBaseDownloadRequest* user_data, LLExtStat ext_status);
|
||||
static void downloadEstateAssetCompleteCallback(
|
||||
S32 result,
|
||||
const LLUUID& file_id,
|
||||
LLAssetType::EType file_type,
|
||||
void* user_data, LLExtStat ext_status);
|
||||
LLBaseDownloadRequest* user_data, LLExtStat ext_status);
|
||||
static void downloadInvItemCompleteCallback(
|
||||
S32 result,
|
||||
const LLUUID& file_id,
|
||||
LLAssetType::EType file_type,
|
||||
void* user_data, LLExtStat ext_status);
|
||||
LLBaseDownloadRequest* user_data, LLExtStat ext_status);
|
||||
|
||||
// upload process callbacks
|
||||
static void uploadCompleteCallback(const LLUUID&, void *user_data, S32 result, LLExtStat ext_status);
|
||||
@@ -397,20 +359,6 @@ public:
|
||||
// deprecated file-based methods
|
||||
void getAssetData(const LLUUID uuid, LLAssetType::EType type, void (*callback)(const char*, const LLUUID&, void *, S32, LLExtStat), void *user_data, BOOL is_priority = FALSE);
|
||||
|
||||
/*
|
||||
* AssetID version.
|
||||
*/
|
||||
virtual void storeAssetData(
|
||||
const std::string& filename,
|
||||
const LLUUID& asset_id,
|
||||
LLAssetType::EType type,
|
||||
LLStoreAssetCallback callback,
|
||||
void* user_data,
|
||||
bool temp_file = false,
|
||||
bool is_priority = false,
|
||||
bool user_waiting = false,
|
||||
F64Seconds timeout = LL_ASSET_STORAGE_TIMEOUT);
|
||||
|
||||
/*
|
||||
* TransactionID version
|
||||
*/
|
||||
@@ -423,23 +371,11 @@ public:
|
||||
bool temp_file = false,
|
||||
bool is_priority = false,
|
||||
bool user_waiting = false,
|
||||
F64Seconds timeout = LL_ASSET_STORAGE_TIMEOUT);
|
||||
F64Seconds timeout = LL_ASSET_STORAGE_TIMEOUT) = 0;
|
||||
|
||||
static void legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType, void *user_data, S32 status, LLExtStat ext_status);
|
||||
static void legacyStoreDataCallback(const LLUUID &uuid, void *user_data, S32 status, LLExtStat ext_status);
|
||||
|
||||
// Temp assets are stored on sim nodes, they have agent ID and location data associated with them.
|
||||
// This is a no-op for non-http asset systems
|
||||
virtual void addTempAssetData(const LLUUID& asset_id, const LLUUID& agent_id, const std::string& host_name);
|
||||
virtual BOOL hasTempAssetData(const LLUUID& texture_id) const;
|
||||
virtual std::string getTempAssetHostName(const LLUUID& texture_id) const;
|
||||
virtual LLUUID getTempAssetAgentID(const LLUUID& texture_id) const;
|
||||
virtual void removeTempAssetData(const LLUUID& asset_id);
|
||||
virtual void removeTempAssetDataByAgentID(const LLUUID& agent_id);
|
||||
// Pass LLUUID::null for all
|
||||
virtual void dumpTempAssetData(const LLUUID& avatar_id) const;
|
||||
virtual void clearTempAssetData();
|
||||
|
||||
// add extra methods to handle metadata
|
||||
|
||||
protected:
|
||||
@@ -449,7 +385,7 @@ protected:
|
||||
virtual void _queueDataRequest(const LLUUID& uuid, LLAssetType::EType type,
|
||||
void (*callback)(LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat),
|
||||
void *user_data, BOOL duplicate,
|
||||
BOOL is_priority);
|
||||
BOOL is_priority) = 0;
|
||||
|
||||
private:
|
||||
void _init(LLMessageSystem *msg,
|
||||
|
||||
@@ -42,7 +42,7 @@ LLTransferTargetParamsVFile::LLTransferTargetParamsVFile() :
|
||||
LLTransferTargetParams(LLTTT_VFILE),
|
||||
mAssetType(LLAssetType::AT_NONE),
|
||||
mCompleteCallback(NULL),
|
||||
mUserDatap(NULL),
|
||||
mRequestDatap(NULL),
|
||||
mErrCode(0)
|
||||
{
|
||||
}
|
||||
@@ -55,10 +55,14 @@ void LLTransferTargetParamsVFile::setAsset(
|
||||
mAssetType = asset_type;
|
||||
}
|
||||
|
||||
void LLTransferTargetParamsVFile::setCallback(LLTTVFCompleteCallback cb, void *user_data)
|
||||
void LLTransferTargetParamsVFile::setCallback(LLTTVFCompleteCallback cb, LLBaseDownloadRequest& request)
|
||||
{
|
||||
mCompleteCallback = cb;
|
||||
mUserDatap = user_data;
|
||||
if (mRequestDatap)
|
||||
{
|
||||
delete mRequestDatap;
|
||||
}
|
||||
mRequestDatap = request.getCopy();
|
||||
}
|
||||
|
||||
bool LLTransferTargetParamsVFile::unpackParams(LLDataPacker& dp)
|
||||
@@ -98,6 +102,12 @@ LLTransferTargetVFile::LLTransferTargetVFile(
|
||||
|
||||
LLTransferTargetVFile::~LLTransferTargetVFile()
|
||||
{
|
||||
if (mParams.mRequestDatap)
|
||||
{
|
||||
// TODO: Consider doing it in LLTransferTargetParamsVFile's destructor
|
||||
delete mParams.mRequestDatap;
|
||||
mParams.mRequestDatap = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -208,12 +218,18 @@ void LLTransferTargetVFile::completionCallback(const LLTSCode status)
|
||||
err_code = LL_ERR_ASSET_REQUEST_FAILED;
|
||||
break;
|
||||
}
|
||||
if (mParams.mCompleteCallback)
|
||||
{
|
||||
mParams.mCompleteCallback(err_code,
|
||||
mParams.getAssetID(),
|
||||
mParams.getAssetType(),
|
||||
mParams.mUserDatap,
|
||||
LL_EXSTAT_NONE);
|
||||
}
|
||||
|
||||
if (mParams.mRequestDatap)
|
||||
{
|
||||
if (mParams.mCompleteCallback)
|
||||
{
|
||||
mParams.mCompleteCallback(err_code,
|
||||
mParams.getAssetID(),
|
||||
mParams.getAssetType(),
|
||||
mParams.mRequestDatap,
|
||||
LL_EXSTAT_NONE);
|
||||
}
|
||||
delete mParams.mRequestDatap;
|
||||
mParams.mRequestDatap = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ typedef void (*LLTTVFCompleteCallback)(
|
||||
S32 status,
|
||||
const LLUUID& file_id,
|
||||
LLAssetType::EType file_type,
|
||||
void* user_data, LLExtStat ext_status );
|
||||
LLBaseDownloadRequest* user_data, LLExtStat ext_status );
|
||||
|
||||
class LLTransferTargetParamsVFile : public LLTransferTargetParams
|
||||
{
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
LLTransferTargetParamsVFile();
|
||||
|
||||
void setAsset(const LLUUID& asset_id, LLAssetType::EType asset_type);
|
||||
void setCallback(LLTTVFCompleteCallback cb, void* user_data);
|
||||
void setCallback(LLTTVFCompleteCallback cb, LLBaseDownloadRequest& request);
|
||||
|
||||
LLUUID getAssetID() const { return mAssetID; }
|
||||
LLAssetType::EType getAssetType() const { return mAssetType; }
|
||||
@@ -60,7 +60,7 @@ protected:
|
||||
LLAssetType::EType mAssetType;
|
||||
|
||||
LLTTVFCompleteCallback mCompleteCallback;
|
||||
void* mUserDatap;
|
||||
LLBaseDownloadRequest* mRequestDatap;
|
||||
S32 mErrCode;
|
||||
};
|
||||
|
||||
|
||||
@@ -51,9 +51,10 @@
|
||||
class LLViewerAssetRequest : public LLAssetRequest
|
||||
{
|
||||
public:
|
||||
LLViewerAssetRequest(const LLUUID &uuid, const LLAssetType::EType type)
|
||||
LLViewerAssetRequest(const LLUUID &uuid, const LLAssetType::EType type, bool with_http)
|
||||
: LLAssetRequest(uuid, type),
|
||||
mMetricsStartTime(0)
|
||||
mMetricsStartTime(0),
|
||||
mWithHTTP(with_http)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -66,6 +67,12 @@ public:
|
||||
recordMetrics();
|
||||
}
|
||||
|
||||
LLBaseDownloadRequest* getCopy()
|
||||
{
|
||||
return new LLViewerAssetRequest(*this);
|
||||
}
|
||||
bool operator==(const LLViewerAssetRequest& rhs) const { return mUUID == rhs.mUUID && mType == rhs.mType && mWithHTTP == rhs.mWithHTTP; }
|
||||
|
||||
protected:
|
||||
void recordMetrics()
|
||||
{
|
||||
@@ -73,8 +80,8 @@ protected:
|
||||
{
|
||||
// Okay, it appears this request was used for useful things. Record
|
||||
// the expected dequeue and duration of request processing.
|
||||
LLViewerAssetStatsFF::record_dequeue_main(mType, false, false);
|
||||
LLViewerAssetStatsFF::record_response_main(mType, false, false,
|
||||
LLViewerAssetStatsFF::record_dequeue_main(mType, mWithHTTP, false);
|
||||
LLViewerAssetStatsFF::record_response_main(mType, mWithHTTP, false,
|
||||
(LLViewerAssetStatsFF::get_timestamp()
|
||||
- mMetricsStartTime));
|
||||
mMetricsStartTime = (U32Seconds)0;
|
||||
@@ -83,6 +90,7 @@ protected:
|
||||
|
||||
public:
|
||||
LLViewerAssetStats::duration_t mMetricsStartTime;
|
||||
bool mWithHTTP;
|
||||
};
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
@@ -138,7 +146,7 @@ void LLViewerAssetStorage::storeAssetData(
|
||||
if (asset_size < 1)
|
||||
{
|
||||
// This can happen if there's a bug in our code or if the VFS has been corrupted.
|
||||
LL_WARNS() << "LLViewerAssetStorage::storeAssetData() Data _should_ already be in the VFS, but it's not! " << asset_id << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "LLViewerAssetStorage::storeAssetData() Data _should_ already be in the VFS, but it's not! " << asset_id << LL_ENDL;
|
||||
// LLAssetStorage metric: Zero size VFS
|
||||
reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" );
|
||||
|
||||
@@ -179,7 +187,7 @@ void LLViewerAssetStorage::storeAssetData(
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "Probable corruption in VFS file, aborting store asset data" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "Probable corruption in VFS file, aborting store asset data" << LL_ENDL;
|
||||
|
||||
// LLAssetStorage metric: VFS corrupt - bogus size
|
||||
reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, asset_size, MR_VFS_CORRUPTION, __FILE__, __LINE__, "VFS corruption" );
|
||||
@@ -208,7 +216,7 @@ void LLViewerAssetStorage::storeAssetData(
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "AssetStorage: attempt to upload non-existent vfile " << asset_id << ":" << LLAssetType::lookup(asset_type) << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "AssetStorage: attempt to upload non-existent vfile " << asset_id << ":" << LLAssetType::lookup(asset_type) << LL_ENDL;
|
||||
// LLAssetStorage metric: Zero size VFS
|
||||
reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" );
|
||||
if (callback)
|
||||
@@ -219,7 +227,7 @@ void LLViewerAssetStorage::storeAssetData(
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "Attempt to move asset store request upstream w/o valid upstream provider" << LL_ENDL;
|
||||
LL_WARNS("AssetStorage") << "Attempt to move asset store request upstream w/o valid upstream provider" << LL_ENDL;
|
||||
// LLAssetStorage metric: Upstream provider dead
|
||||
reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_NO_UPSTREAM, __FILE__, __LINE__, "No upstream provider" );
|
||||
if (callback)
|
||||
@@ -316,7 +324,6 @@ void LLViewerAssetStorage::storeAssetData(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Allocate and queue an asset fetch request for the viewer
|
||||
*
|
||||
@@ -342,11 +349,21 @@ void LLViewerAssetStorage::_queueDataRequest(
|
||||
void *user_data,
|
||||
BOOL duplicate,
|
||||
BOOL is_priority)
|
||||
{
|
||||
queueRequestUDP(uuid, atype, callback, user_data, duplicate, is_priority);
|
||||
}
|
||||
void LLViewerAssetStorage::queueRequestUDP(
|
||||
const LLUUID& uuid,
|
||||
LLAssetType::EType atype,
|
||||
LLGetAssetCallback callback,
|
||||
void *user_data,
|
||||
BOOL duplicate,
|
||||
BOOL is_priority)
|
||||
{
|
||||
if (mUpstreamHost.isOk())
|
||||
{
|
||||
// stash the callback info so we can find it after we get the response message
|
||||
LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype);
|
||||
bool with_http = false;
|
||||
LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype, with_http);
|
||||
req->mDownCallback = callback;
|
||||
req->mUserData = user_data;
|
||||
req->mIsPriority = is_priority;
|
||||
@@ -369,13 +386,15 @@ void LLViewerAssetStorage::_queueDataRequest(
|
||||
// Set our destination file, and the completion callback.
|
||||
LLTransferTargetParamsVFile tpvf;
|
||||
tpvf.setAsset(uuid, atype);
|
||||
tpvf.setCallback(downloadCompleteCallback, req);
|
||||
tpvf.setCallback(downloadCompleteCallback, *req);
|
||||
|
||||
LL_DEBUGS("AssetStorage") << "Starting transfer for " << uuid << LL_ENDL;
|
||||
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(mUpstreamHost, LLTCT_ASSET);
|
||||
ttcp->requestTransfer(spa, tpvf, 100.f + (is_priority ? 1.f : 0.f));
|
||||
|
||||
LLViewerAssetStatsFF::record_enqueue_main(atype, false, false);
|
||||
bool with_http = false;
|
||||
bool is_temp = false;
|
||||
LLViewerAssetStatsFF::record_enqueue_main(atype, with_http, is_temp);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -41,7 +41,6 @@ public:
|
||||
LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
|
||||
LLVFS *vfs, LLVFS *static_vfs);
|
||||
|
||||
using LLAssetStorage::storeAssetData;
|
||||
virtual void storeAssetData(
|
||||
const LLTransactionID& tid,
|
||||
LLAssetType::EType atype,
|
||||
@@ -65,7 +64,6 @@ public:
|
||||
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
|
||||
|
||||
protected:
|
||||
using LLAssetStorage::_queueDataRequest;
|
||||
|
||||
// virtual
|
||||
void _queueDataRequest(const LLUUID& uuid,
|
||||
@@ -74,6 +72,15 @@ protected:
|
||||
void *user_data,
|
||||
BOOL duplicate,
|
||||
BOOL is_priority);
|
||||
|
||||
|
||||
void queueRequestUDP(const LLUUID& uuid,
|
||||
LLAssetType::EType type,
|
||||
void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat),
|
||||
void *user_data,
|
||||
BOOL duplicate,
|
||||
BOOL is_priority);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user