Http asset fetching.

This commit is contained in:
Shyotl
2017-06-20 19:44:59 -05:00
parent 7a5857e838
commit 733fca3d49
6 changed files with 322 additions and 454 deletions

View File

@@ -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 const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds
LLTempAssetStorage::~LLTempAssetStorage()
{
}
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// LLAssetInfo /// LLAssetInfo
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
@@ -157,25 +153,44 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv )
/// LLAssetRequest /// LLAssetRequest
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
LLAssetRequest::LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType type) LLBaseDownloadRequest::LLBaseDownloadRequest(const LLUUID &uuid, const LLAssetType::EType type)
: mUUID(uuid), : mUUID(uuid),
mType(type), mType(type),
mDownCallback( NULL ), mDownCallback(NULL),
mUpCallback( NULL ), mUserData(NULL),
mInfoCallback( NULL ), mHost(),
mUserData( NULL ), mIsTemp(FALSE),
mHost(), mIsPriority(FALSE),
mIsTemp( FALSE ), mDataSentInFirstPacket(FALSE),
mIsLocal(FALSE), mDataIsInVFS(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
mIsPriority(FALSE), // running a message system loop.
mDataSentInFirstPacket(FALSE), mTime = LLMessageSystem::getMessageTimeSeconds(TRUE);
mDataIsInVFS( FALSE ) }
// 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 // virtual
@@ -213,56 +228,50 @@ LLSD LLAssetRequest::getFullDetails() const
return sd; return sd;
} }
LLBaseDownloadRequest* LLAssetRequest::getCopy()
{
return new LLAssetRequest(*this);
}
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// LLInvItemRequest /// LLInvItemRequest
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
LLInvItemRequest::LLInvItemRequest(const LLUUID &uuid, const LLAssetType::EType type) LLInvItemRequest::LLInvItemRequest(const LLUUID &uuid, const LLAssetType::EType type)
: mUUID(uuid), : LLBaseDownloadRequest(uuid, type)
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
LLInvItemRequest::~LLInvItemRequest() LLInvItemRequest::~LLInvItemRequest()
{ {
} }
LLBaseDownloadRequest* LLInvItemRequest::getCopy()
{
return new LLInvItemRequest(*this);
}
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// LLEstateAssetRequest /// LLEstateAssetRequest
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
LLEstateAssetRequest::LLEstateAssetRequest(const LLUUID &uuid, const LLAssetType::EType atype, LLEstateAssetRequest::LLEstateAssetRequest(const LLUUID &uuid, const LLAssetType::EType atype,
EstateAssetType etype) EstateAssetType etype)
: mUUID(uuid), : LLBaseDownloadRequest(uuid, atype),
mAType(atype), mEstateAssetType(etype)
mEstateAssetType(etype),
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
LLEstateAssetRequest::~LLEstateAssetRequest() LLEstateAssetRequest::~LLEstateAssetRequest()
{ {
} }
LLBaseDownloadRequest* LLEstateAssetRequest::getCopy()
{
return new LLEstateAssetRequest(*this);
}
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// LLAssetStorage /// LLAssetStorage
@@ -356,7 +365,7 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error)
|| ((RT_DOWNLOAD == rt) || ((RT_DOWNLOAD == rt)
&& LL_ASSET_STORAGE_TIMEOUT < (mt_secs - tmp->mTime))) && 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 " << (all ? "aborted" : "timed out") << " for "
<< tmp->getUUID() << "." << tmp->getUUID() << "."
<< LLAssetType::lookup(tmp->getType()) << LL_ENDL; << LLAssetType::lookup(tmp->getType()) << LL_ENDL;
@@ -420,7 +429,7 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse
} }
else 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; << " 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 & // 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; 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) 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(); file.remove();
} }
@@ -520,7 +533,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
if (callback == tmp->mDownCallback && user_data == tmp->mUserData) if (callback == tmp->mDownCallback && user_data == tmp->mUserData)
{ {
// this is a duplicate from the same subsystem - throw it away // 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; << "." << LLAssetType::lookup(type) << LL_ENDL;
return; return;
} }
@@ -542,107 +555,11 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
} }
// // static
// *NOTE: Logic here is replicated in LLViewerAssetStorage::_queueDataRequest. void LLAssetStorage::removeAndCallbackPendingDownloads(const LLUUID& file_id, LLAssetType::EType file_type,
// Changes here may need to be replicated in the viewer's derived class. const LLUUID& callback_id, LLAssetType::EType callback_type,
// S32 result_code, LLExtStat ext_status)
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();
// find and callback ALL pending requests for this UUID // 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, // 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. // but I didn't want to mess with it.
@@ -665,15 +582,82 @@ void LLAssetStorage::downloadCompleteCallback(
LLAssetRequest* tmp = *curiter; LLAssetRequest* tmp = *curiter;
if (tmp->mDownCallback) 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; delete tmp;
} }
} }
void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id, void LLAssetStorage::downloadCompleteCallback(
const LLUUID &asset_id, LLAssetType::EType atype, EstateAssetType etype, S32 result,
LLGetAssetCallback callback, void *user_data, BOOL is_priority) 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; 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) 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(); file.remove();
} }
@@ -731,10 +715,10 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
if (source_host.isOk()) if (source_host.isOk())
{ {
// stash the callback info so we can find it after we get the response message // stash the callback info so we can find it after we get the response message
LLEstateAssetRequest *req = new LLEstateAssetRequest(asset_id, atype, etype); LLEstateAssetRequest req(asset_id, atype, etype);
req->mDownCallback = callback; req.mDownCallback = callback;
req->mUserData = user_data; req.mUserData = user_data;
req->mIsPriority = is_priority; req.mIsPriority = is_priority;
// send request message to our upstream data provider // send request message to our upstream data provider
// Create a new asset transfer. // Create a new asset transfer.
@@ -754,7 +738,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
else else
{ {
// uh-oh, we shouldn't have gotten here // 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) if (callback)
{ {
callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM); callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
@@ -767,19 +751,19 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
S32 result, S32 result,
const LLUUID& file_id, const LLUUID& file_id,
LLAssetType::EType file_type, LLAssetType::EType file_type,
void* user_data, LLBaseDownloadRequest* user_data,
LLExtStat ext_status) LLExtStat ext_status)
{ {
LLEstateAssetRequest *req = (LLEstateAssetRequest*)user_data; LLEstateAssetRequest *req = (LLEstateAssetRequest*)user_data;
if(!req) if(!req)
{ {
LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called" LL_WARNS("AssetStorage") << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
" without a valid request." << LL_ENDL; " without a valid request." << LL_ENDL;
return; return;
} }
if (!gAssetStorage) if (!gAssetStorage)
{ {
LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called" LL_WARNS("AssetStorage") << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
" without any asset system, aborting!" << LL_ENDL; " without any asset system, aborting!" << LL_ENDL;
return; return;
} }
@@ -792,7 +776,7 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getAType()); LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getAType());
if (vfile.getSize() <= 0) 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; result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
vfile.remove(); vfile.remove();
@@ -802,26 +786,21 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getAType(), req->mUserData, result, ext_status); 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, void LLAssetStorage::getInvItemAsset(
const LLUUID &owner_id, const LLUUID &task_id, const LLUUID &item_id, const LLHost &object_sim,
const LLUUID &asset_id, LLAssetType::EType atype, const LLUUID &agent_id,
LLGetAssetCallback callback, void *user_data, BOOL is_priority) 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; 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; bool exists = false;
U32 size = 0; U32 size = 0;
@@ -838,7 +817,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
size = exists ? file.getSize() : 0; size = exists ? file.getSize() : 0;
if(exists && size < 1) 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(); file.remove();
} }
@@ -870,10 +849,10 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
if (source_host.isOk()) if (source_host.isOk())
{ {
// stash the callback info so we can find it after we get the response message // stash the callback info so we can find it after we get the response message
LLInvItemRequest *req = new LLInvItemRequest(asset_id, atype); LLInvItemRequest req(asset_id, atype);
req->mDownCallback = callback; req.mDownCallback = callback;
req->mUserData = user_data; req.mUserData = user_data;
req->mIsPriority = is_priority; req.mIsPriority = is_priority;
// send request message to our upstream data provider // send request message to our upstream data provider
// Create a new asset transfer. // Create a new asset transfer.
@@ -896,7 +875,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
else else
{ {
// uh-oh, we shouldn't have gotten here // 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) if (callback)
{ {
callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM); callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
@@ -910,19 +889,19 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
S32 result, S32 result,
const LLUUID& file_id, const LLUUID& file_id,
LLAssetType::EType file_type, LLAssetType::EType file_type,
void* user_data, LLBaseDownloadRequest* user_data,
LLExtStat ext_status) LLExtStat ext_status)
{ {
LLInvItemRequest *req = (LLInvItemRequest*)user_data; LLInvItemRequest *req = (LLInvItemRequest*)user_data;
if(!req) if(!req)
{ {
LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called" LL_WARNS("AssetStorage") << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
" without a valid request." << LL_ENDL; " without a valid request." << LL_ENDL;
return; return;
} }
if (!gAssetStorage) 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; return;
} }
@@ -934,7 +913,7 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType()); LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType());
if (vfile.getSize() <= 0) 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; result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
vfile.remove(); vfile.remove();
@@ -949,11 +928,15 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
///////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// static // 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) if (!gAssetStorage)
{ {
LL_WARNS() << "LLAssetStorage::uploadCompleteCallback has no gAssetStorage!" << LL_ENDL; LL_WARNS("AssetStorage") << "LLAssetStorage::uploadCompleteCallback has no gAssetStorage!" << LL_ENDL;
return; return;
} }
LLAssetRequest *req = (LLAssetRequest *)user_data; LLAssetRequest *req = (LLAssetRequest *)user_data;
@@ -961,7 +944,7 @@ void LLAssetStorage::uploadCompleteCallback(const LLUUID& uuid, void *user_data,
if (result) 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; success = FALSE;
} }
@@ -1043,7 +1026,7 @@ LLAssetStorage::request_list_t* LLAssetStorage::getRequestList(LLAssetStorage::E
case RT_LOCALUPLOAD: case RT_LOCALUPLOAD:
return &mPendingLocalUploads; return &mPendingLocalUploads;
default: 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; return NULL;
} }
} }
@@ -1059,7 +1042,7 @@ const LLAssetStorage::request_list_t* LLAssetStorage::getRequestList(LLAssetStor
case RT_LOCALUPLOAD: case RT_LOCALUPLOAD:
return &mPendingLocalUploads; return &mPendingLocalUploads;
default: 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; return NULL;
} }
} }
@@ -1076,7 +1059,7 @@ std::string LLAssetStorage::getRequestName(LLAssetStorage::ERequestType rt)
case RT_LOCALUPLOAD: case RT_LOCALUPLOAD:
return "localupload"; return "localupload";
default: 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 ""; return "";
} }
} }
@@ -1307,9 +1290,15 @@ const char* LLAssetStorage::getErrorString(S32 status)
} }
} }
void LLAssetStorage::getAssetData(const LLUUID uuid,
LLAssetType::EType type,
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 (*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 // check for duplicates here, since we're about to fool the normal duplicate checker
for (request_list_t::iterator iter = mPendingDownloads.begin(); for (request_list_t::iterator iter = mPendingDownloads.begin();
@@ -1339,7 +1328,12 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo
} }
// static // 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; LLLegacyAssetRequest *legacy = (LLLegacyAssetRequest *)user_data;
std::string filename; std::string filename;
@@ -1383,78 +1377,6 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAss
delete legacy; 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 // static
void LLAssetStorage::legacyStoreDataCallback(const LLUUID &uuid, void *user_data, S32 status, LLExtStat ext_status) 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; 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 // static
void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::EType asset_type, const std::string& in_filename, 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, const LLUUID& agent_id, S32 asset_size, EMetricResult result,

View File

@@ -92,18 +92,19 @@ public:
}; };
class LLAssetRequest class LLBaseDownloadRequest
{ {
public: public:
LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType at); LLBaseDownloadRequest(const LLUUID &uuid, const LLAssetType::EType at);
virtual ~LLAssetRequest(); virtual ~LLBaseDownloadRequest();
LLUUID getUUID() const { return mUUID; } LLUUID getUUID() const { return mUUID; }
LLAssetType::EType getType() const { return mType; } LLAssetType::EType getType() const { return mType; }
void setUUID(const LLUUID& id) { mUUID = id; } void setUUID(const LLUUID& id) { mUUID = id; }
void setType(LLAssetType::EType type) { mType = type; } void setType(LLAssetType::EType type) { mType = type; }
void setTimeout (F64Seconds timeout) { mTimeout = timeout; }
virtual LLBaseDownloadRequest* getCopy();
protected: protected:
LLUUID mUUID; LLUUID mUUID;
@@ -111,19 +112,35 @@ protected:
public: public:
void (*mDownCallback)(LLVFS*, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat); void (*mDownCallback)(LLVFS*, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat);
void (*mUpCallback)(const LLUUID&, void *, S32, LLExtStat);
void (*mInfoCallback)(LLAssetInfo *, void *, S32);
void *mUserData; void *mUserData;
LLHost mHost; LLHost mHost;
BOOL mIsTemp; 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 mTime; // Message system time
F64Seconds mTimeout; // Amount of time before timing out.
BOOL mIsPriority; BOOL mIsPriority;
BOOL mDataSentInFirstPacket; BOOL mDataSentInFirstPacket;
BOOL mDataIsInVFS; 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 LLUUID mRequestingAgentID; // Only valid for uploads from an agent
virtual LLSD getTerseDetails() const; 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: public:
LLInvItemRequest(const LLUUID &uuid, const LLAssetType::EType at); LLInvItemRequest(const LLUUID &uuid, const LLAssetType::EType at);
virtual ~LLInvItemRequest(); virtual ~LLInvItemRequest();
LLUUID getUUID() const { return mUUID; } virtual LLBaseDownloadRequest* getCopy();
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;
}; };
class LLEstateAssetRequest class LLEstateAssetRequest : public LLBaseDownloadRequest
{ {
public: public:
LLEstateAssetRequest(const LLUUID &uuid, const LLAssetType::EType at, EstateAssetType et); LLEstateAssetRequest(const LLUUID &uuid, const LLAssetType::EType at, EstateAssetType et);
virtual ~LLEstateAssetRequest(); virtual ~LLEstateAssetRequest();
LLUUID getUUID() const { return mUUID; } LLAssetType::EType getAType() const { return mType; }
LLAssetType::EType getAType() const { return mAType; }
void setUUID(const LLUUID& id) { mUUID = id; } virtual LLBaseDownloadRequest* getCopy();
void setType(LLAssetType::EType type) { mAType = type; }
protected: protected:
LLUUID mUUID;
LLAssetType::EType mAType;
EstateAssetType mEstateAssetType; 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, typedef void (*LLGetAssetCallback)(LLVFS *vfs, const LLUUID &asset_id,
LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status); 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: public:
// VFS member is public because static child methods need it :( // VFS member is public because static child methods need it :(
@@ -263,12 +236,12 @@ public:
return mUpstreamHost.isOk(); return mUpstreamHost.isOk();
} }
virtual BOOL hasLocalAsset(const LLUUID &uuid, LLAssetType::EType type); BOOL hasLocalAsset(const LLUUID &uuid, LLAssetType::EType type);
// public interface methods // public interface methods
// note that your callback may get called BEFORE the function returns // 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; std::vector<LLUUID> mBlackListedAsset;
@@ -285,25 +258,10 @@ public:
bool is_priority = false, bool is_priority = false,
bool store_local = false, bool store_local = false,
bool user_waiting= 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, void getEstateAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id,
const LLUUID &asset_id, LLAssetType::EType atype, EstateAssetType etype, const LLUUID &asset_id, LLAssetType::EType atype, EstateAssetType etype,
@@ -328,15 +286,15 @@ protected:
bool findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type, bool findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type,
LLGetAssetCallback callback, void *user_data); LLGetAssetCallback callback, void *user_data);
virtual LLSD getPendingDetailsImpl(const request_list_t* requests, LLSD getPendingDetailsImpl(const request_list_t* requests,
LLAssetType::EType asset_type, LLAssetType::EType asset_type,
const std::string& detail_prefix) const; 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, LLAssetType::EType asset_type,
const LLUUID& asset_id) const; const LLUUID& asset_id) const;
virtual bool deletePendingRequestImpl(request_list_t* requests, bool deletePendingRequestImpl(request_list_t* requests,
LLAssetType::EType asset_type, LLAssetType::EType asset_type,
const LLUUID& asset_id); const LLUUID& asset_id);
@@ -357,35 +315,39 @@ public:
S32 getNumPendingLocalUploads(); S32 getNumPendingLocalUploads();
S32 getNumPending(ERequestType rt) const; S32 getNumPending(ERequestType rt) const;
virtual LLSD getPendingDetails(ERequestType rt, LLSD getPendingDetails(ERequestType rt,
LLAssetType::EType asset_type, LLAssetType::EType asset_type,
const std::string& detail_prefix) const; const std::string& detail_prefix) const;
virtual LLSD getPendingRequest(ERequestType rt, LLSD getPendingRequest(ERequestType rt,
LLAssetType::EType asset_type, LLAssetType::EType asset_type,
const LLUUID& asset_id) const; const LLUUID& asset_id) const;
virtual bool deletePendingRequest(ERequestType rt, bool deletePendingRequest(ERequestType rt,
LLAssetType::EType asset_type, LLAssetType::EType asset_type,
const LLUUID& asset_id); 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 // download process callbacks
static void downloadCompleteCallback( static void downloadCompleteCallback(
S32 result, S32 result,
const LLUUID& file_id, const LLUUID& file_id,
LLAssetType::EType file_type, LLAssetType::EType file_type,
void* user_data, LLExtStat ext_status); LLBaseDownloadRequest* user_data, LLExtStat ext_status);
static void downloadEstateAssetCompleteCallback( static void downloadEstateAssetCompleteCallback(
S32 result, S32 result,
const LLUUID& file_id, const LLUUID& file_id,
LLAssetType::EType file_type, LLAssetType::EType file_type,
void* user_data, LLExtStat ext_status); LLBaseDownloadRequest* user_data, LLExtStat ext_status);
static void downloadInvItemCompleteCallback( static void downloadInvItemCompleteCallback(
S32 result, S32 result,
const LLUUID& file_id, const LLUUID& file_id,
LLAssetType::EType file_type, LLAssetType::EType file_type,
void* user_data, LLExtStat ext_status); LLBaseDownloadRequest* user_data, LLExtStat ext_status);
// upload process callbacks // upload process callbacks
static void uploadCompleteCallback(const LLUUID&, void *user_data, S32 result, LLExtStat ext_status); static void uploadCompleteCallback(const LLUUID&, void *user_data, S32 result, LLExtStat ext_status);
@@ -397,20 +359,6 @@ public:
// deprecated file-based methods // 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); 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 * TransactionID version
*/ */
@@ -423,23 +371,11 @@ public:
bool temp_file = false, bool temp_file = false,
bool is_priority = false, bool is_priority = false,
bool user_waiting = 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 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); 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 // add extra methods to handle metadata
protected: protected:
@@ -449,7 +385,7 @@ protected:
virtual void _queueDataRequest(const LLUUID& uuid, LLAssetType::EType type, virtual void _queueDataRequest(const LLUUID& uuid, LLAssetType::EType type,
void (*callback)(LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), void (*callback)(LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat),
void *user_data, BOOL duplicate, void *user_data, BOOL duplicate,
BOOL is_priority); BOOL is_priority) = 0;
private: private:
void _init(LLMessageSystem *msg, void _init(LLMessageSystem *msg,

View File

@@ -42,7 +42,7 @@ LLTransferTargetParamsVFile::LLTransferTargetParamsVFile() :
LLTransferTargetParams(LLTTT_VFILE), LLTransferTargetParams(LLTTT_VFILE),
mAssetType(LLAssetType::AT_NONE), mAssetType(LLAssetType::AT_NONE),
mCompleteCallback(NULL), mCompleteCallback(NULL),
mUserDatap(NULL), mRequestDatap(NULL),
mErrCode(0) mErrCode(0)
{ {
} }
@@ -55,10 +55,14 @@ void LLTransferTargetParamsVFile::setAsset(
mAssetType = asset_type; mAssetType = asset_type;
} }
void LLTransferTargetParamsVFile::setCallback(LLTTVFCompleteCallback cb, void *user_data) void LLTransferTargetParamsVFile::setCallback(LLTTVFCompleteCallback cb, LLBaseDownloadRequest& request)
{ {
mCompleteCallback = cb; mCompleteCallback = cb;
mUserDatap = user_data; if (mRequestDatap)
{
delete mRequestDatap;
}
mRequestDatap = request.getCopy();
} }
bool LLTransferTargetParamsVFile::unpackParams(LLDataPacker& dp) bool LLTransferTargetParamsVFile::unpackParams(LLDataPacker& dp)
@@ -98,6 +102,12 @@ LLTransferTargetVFile::LLTransferTargetVFile(
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; err_code = LL_ERR_ASSET_REQUEST_FAILED;
break; break;
} }
if (mParams.mCompleteCallback)
{ if (mParams.mRequestDatap)
mParams.mCompleteCallback(err_code, {
mParams.getAssetID(), if (mParams.mCompleteCallback)
mParams.getAssetType(), {
mParams.mUserDatap, mParams.mCompleteCallback(err_code,
LL_EXSTAT_NONE); mParams.getAssetID(),
} mParams.getAssetType(),
mParams.mRequestDatap,
LL_EXSTAT_NONE);
}
delete mParams.mRequestDatap;
mParams.mRequestDatap = NULL;
}
} }

View File

@@ -39,7 +39,7 @@ typedef void (*LLTTVFCompleteCallback)(
S32 status, S32 status,
const LLUUID& file_id, const LLUUID& file_id,
LLAssetType::EType file_type, LLAssetType::EType file_type,
void* user_data, LLExtStat ext_status ); LLBaseDownloadRequest* user_data, LLExtStat ext_status );
class LLTransferTargetParamsVFile : public LLTransferTargetParams class LLTransferTargetParamsVFile : public LLTransferTargetParams
{ {
@@ -47,7 +47,7 @@ public:
LLTransferTargetParamsVFile(); LLTransferTargetParamsVFile();
void setAsset(const LLUUID& asset_id, LLAssetType::EType asset_type); 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; } LLUUID getAssetID() const { return mAssetID; }
LLAssetType::EType getAssetType() const { return mAssetType; } LLAssetType::EType getAssetType() const { return mAssetType; }
@@ -60,7 +60,7 @@ protected:
LLAssetType::EType mAssetType; LLAssetType::EType mAssetType;
LLTTVFCompleteCallback mCompleteCallback; LLTTVFCompleteCallback mCompleteCallback;
void* mUserDatap; LLBaseDownloadRequest* mRequestDatap;
S32 mErrCode; S32 mErrCode;
}; };

View File

@@ -51,9 +51,10 @@
class LLViewerAssetRequest : public LLAssetRequest class LLViewerAssetRequest : public LLAssetRequest
{ {
public: public:
LLViewerAssetRequest(const LLUUID &uuid, const LLAssetType::EType type) LLViewerAssetRequest(const LLUUID &uuid, const LLAssetType::EType type, bool with_http)
: LLAssetRequest(uuid, type), : LLAssetRequest(uuid, type),
mMetricsStartTime(0) mMetricsStartTime(0),
mWithHTTP(with_http)
{ {
} }
@@ -66,6 +67,12 @@ public:
recordMetrics(); recordMetrics();
} }
LLBaseDownloadRequest* getCopy()
{
return new LLViewerAssetRequest(*this);
}
bool operator==(const LLViewerAssetRequest& rhs) const { return mUUID == rhs.mUUID && mType == rhs.mType && mWithHTTP == rhs.mWithHTTP; }
protected: protected:
void recordMetrics() void recordMetrics()
{ {
@@ -73,8 +80,8 @@ protected:
{ {
// Okay, it appears this request was used for useful things. Record // Okay, it appears this request was used for useful things. Record
// the expected dequeue and duration of request processing. // the expected dequeue and duration of request processing.
LLViewerAssetStatsFF::record_dequeue_main(mType, false, false); LLViewerAssetStatsFF::record_dequeue_main(mType, mWithHTTP, false);
LLViewerAssetStatsFF::record_response_main(mType, false, false, LLViewerAssetStatsFF::record_response_main(mType, mWithHTTP, false,
(LLViewerAssetStatsFF::get_timestamp() (LLViewerAssetStatsFF::get_timestamp()
- mMetricsStartTime)); - mMetricsStartTime));
mMetricsStartTime = (U32Seconds)0; mMetricsStartTime = (U32Seconds)0;
@@ -83,6 +90,7 @@ protected:
public: public:
LLViewerAssetStats::duration_t mMetricsStartTime; LLViewerAssetStats::duration_t mMetricsStartTime;
bool mWithHTTP;
}; };
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
@@ -138,7 +146,7 @@ void LLViewerAssetStorage::storeAssetData(
if (asset_size < 1) if (asset_size < 1)
{ {
// This can happen if there's a bug in our code or if the VFS has been corrupted. // 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 // 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)" ); 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 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 // LLAssetStorage metric: VFS corrupt - bogus size
reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, asset_size, MR_VFS_CORRUPTION, __FILE__, __LINE__, "VFS corruption" ); 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 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 // 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)" ); 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) if (callback)
@@ -219,7 +227,7 @@ void LLViewerAssetStorage::storeAssetData(
} }
else 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 // LLAssetStorage metric: Upstream provider dead
reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_NO_UPSTREAM, __FILE__, __LINE__, "No upstream provider" ); reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_NO_UPSTREAM, __FILE__, __LINE__, "No upstream provider" );
if (callback) if (callback)
@@ -316,7 +324,6 @@ void LLViewerAssetStorage::storeAssetData(
} }
} }
/** /**
* @brief Allocate and queue an asset fetch request for the viewer * @brief Allocate and queue an asset fetch request for the viewer
* *
@@ -342,11 +349,21 @@ void LLViewerAssetStorage::_queueDataRequest(
void *user_data, void *user_data,
BOOL duplicate, BOOL duplicate,
BOOL is_priority) 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()) if (mUpstreamHost.isOk())
{ {
// stash the callback info so we can find it after we get the response message bool with_http = false;
LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype); LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype, with_http);
req->mDownCallback = callback; req->mDownCallback = callback;
req->mUserData = user_data; req->mUserData = user_data;
req->mIsPriority = is_priority; req->mIsPriority = is_priority;
@@ -369,13 +386,15 @@ void LLViewerAssetStorage::_queueDataRequest(
// Set our destination file, and the completion callback. // Set our destination file, and the completion callback.
LLTransferTargetParamsVFile tpvf; LLTransferTargetParamsVFile tpvf;
tpvf.setAsset(uuid, atype); tpvf.setAsset(uuid, atype);
tpvf.setCallback(downloadCompleteCallback, req); tpvf.setCallback(downloadCompleteCallback, *req);
LL_DEBUGS("AssetStorage") << "Starting transfer for " << uuid << LL_ENDL; LL_DEBUGS("AssetStorage") << "Starting transfer for " << uuid << LL_ENDL;
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(mUpstreamHost, LLTCT_ASSET); LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(mUpstreamHost, LLTCT_ASSET);
ttcp->requestTransfer(spa, tpvf, 100.f + (is_priority ? 1.f : 0.f)); 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 else

View File

@@ -41,7 +41,6 @@ public:
LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
LLVFS *vfs, LLVFS *static_vfs); LLVFS *vfs, LLVFS *static_vfs);
using LLAssetStorage::storeAssetData;
virtual void storeAssetData( virtual void storeAssetData(
const LLTransactionID& tid, const LLTransactionID& tid,
LLAssetType::EType atype, LLAssetType::EType atype,
@@ -65,7 +64,6 @@ public:
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT); F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
protected: protected:
using LLAssetStorage::_queueDataRequest;
// virtual // virtual
void _queueDataRequest(const LLUUID& uuid, void _queueDataRequest(const LLUUID& uuid,
@@ -74,6 +72,15 @@ protected:
void *user_data, void *user_data,
BOOL duplicate, BOOL duplicate,
BOOL is_priority); 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 #endif