|
|
|
|
@@ -283,28 +283,30 @@ LLEstateAssetRequest::~LLEstateAssetRequest()
|
|
|
|
|
// TODO: rework tempfile handling?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, const LLHost &upstream_host)
|
|
|
|
|
LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, LLVFS *static_vfs, const LLHost &upstream_host)
|
|
|
|
|
{
|
|
|
|
|
_init(msg, xfer, vfs, upstream_host);
|
|
|
|
|
_init(msg, xfer, vfs, static_vfs, upstream_host);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
|
|
|
|
|
LLVFS *vfs)
|
|
|
|
|
LLVFS *vfs, LLVFS *static_vfs)
|
|
|
|
|
{
|
|
|
|
|
_init(msg, xfer, vfs, LLHost::invalid);
|
|
|
|
|
_init(msg, xfer, vfs, static_vfs, LLHost::invalid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LLAssetStorage::_init(LLMessageSystem *msg,
|
|
|
|
|
LLXferManager *xfer,
|
|
|
|
|
LLVFS *vfs,
|
|
|
|
|
LLVFS *static_vfs,
|
|
|
|
|
const LLHost &upstream_host)
|
|
|
|
|
{
|
|
|
|
|
mShutDown = FALSE;
|
|
|
|
|
mMessageSys = msg;
|
|
|
|
|
mXferManager = xfer;
|
|
|
|
|
mVFS = vfs;
|
|
|
|
|
mStaticVFS = static_vfs;
|
|
|
|
|
|
|
|
|
|
setUpstream(upstream_host);
|
|
|
|
|
msg->setHandlerFuncFast(_PREHASH_AssetUploadComplete, processUploadComplete, (void **)this);
|
|
|
|
|
@@ -396,7 +398,39 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error)
|
|
|
|
|
|
|
|
|
|
BOOL LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType type)
|
|
|
|
|
{
|
|
|
|
|
return mVFS->getExists(uuid, type);
|
|
|
|
|
return mStaticVFS->getExists(uuid, type) || mVFS->getExists(uuid, type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAssetType::EType type,
|
|
|
|
|
LLGetAssetCallback callback, void *user_data)
|
|
|
|
|
{
|
|
|
|
|
if (user_data)
|
|
|
|
|
{
|
|
|
|
|
// The *user_data should not be passed without a callback to clean it up.
|
|
|
|
|
llassert(callback != NULL)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOL exists = mStaticVFS->getExists(uuid, type);
|
|
|
|
|
if (exists)
|
|
|
|
|
{
|
|
|
|
|
LLVFile file(mStaticVFS, uuid, type);
|
|
|
|
|
U32 size = file.getSize();
|
|
|
|
|
if (size > 0)
|
|
|
|
|
{
|
|
|
|
|
// we've already got the file
|
|
|
|
|
if (callback)
|
|
|
|
|
{
|
|
|
|
|
callback(mStaticVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
llwarns << "Asset vfile " << uuid << ":" << type
|
|
|
|
|
<< " found in static cache with bad size " << file.getSize() << ", ignoring" << llendl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
@@ -404,24 +438,39 @@ BOOL LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
// IW - uuid is passed by value to avoid side effects, please don't re-add &
|
|
|
|
|
void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, void (*callback)(LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), void *user_data, BOOL is_priority)
|
|
|
|
|
void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, BOOL is_priority)
|
|
|
|
|
{
|
|
|
|
|
lldebugs << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl;
|
|
|
|
|
|
|
|
|
|
llinfos << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl;
|
|
|
|
|
|
|
|
|
|
if (user_data)
|
|
|
|
|
{
|
|
|
|
|
// The *user_data should not be passed without a callback to clean it up.
|
|
|
|
|
llassert(callback != NULL)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mShutDown)
|
|
|
|
|
{
|
|
|
|
|
return; // don't get the asset or do any callbacks, we are shutting down
|
|
|
|
|
llinfos << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl;
|
|
|
|
|
|
|
|
|
|
if (callback)
|
|
|
|
|
{
|
|
|
|
|
callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_FAILED, LL_EXSTAT_NONE);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (uuid.isNull())
|
|
|
|
|
{
|
|
|
|
|
// Special case early out for NULL uuid
|
|
|
|
|
// Special case early out for NULL uuid and for shutting down
|
|
|
|
|
if (callback)
|
|
|
|
|
{
|
|
|
|
|
callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LL_EXSTAT_NULL_UUID);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* <edit> */
|
|
|
|
|
if(std::find(mBlackListedAsset.begin(),mBlackListedAsset.end(),uuid) != mBlackListedAsset.end())
|
|
|
|
|
{
|
|
|
|
|
@@ -434,11 +483,31 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo
|
|
|
|
|
}
|
|
|
|
|
/* </edit> */
|
|
|
|
|
|
|
|
|
|
// Try static VFS first.
|
|
|
|
|
if (findInStaticVFSAndInvokeCallback(uuid,type,callback,user_data))
|
|
|
|
|
{
|
|
|
|
|
llinfos << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BOOL exists = mVFS->getExists(uuid, type);
|
|
|
|
|
LLVFile file(mVFS, uuid, type);
|
|
|
|
|
U32 size = exists ? file.getSize() : 0;
|
|
|
|
|
|
|
|
|
|
if (size < 1)
|
|
|
|
|
if (size > 0)
|
|
|
|
|
{
|
|
|
|
|
// we've already got the file
|
|
|
|
|
// theoretically, partial files w/o a pending request shouldn't happen
|
|
|
|
|
// unless there's a weird error
|
|
|
|
|
if (callback)
|
|
|
|
|
{
|
|
|
|
|
callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
llinfos << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (exists)
|
|
|
|
|
{
|
|
|
|
|
@@ -477,18 +546,13 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo
|
|
|
|
|
// This can be overridden by subclasses
|
|
|
|
|
_queueDataRequest(uuid, type, callback, user_data, duplicate, is_priority);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// we've already got the file
|
|
|
|
|
// theoretically, partial files w/o a pending request shouldn't happen
|
|
|
|
|
// unless there's a weird error
|
|
|
|
|
if (callback)
|
|
|
|
|
{
|
|
|
|
|
callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// *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,
|
|
|
|
|
@@ -516,7 +580,7 @@ void LLAssetStorage::_queueDataRequest(const LLUUID& uuid, LLAssetType::EType at
|
|
|
|
|
tpvf.setAsset(uuid, atype);
|
|
|
|
|
tpvf.setCallback(downloadCompleteCallback, req);
|
|
|
|
|
|
|
|
|
|
llinfos << "Starting transfer for " << uuid << llendl;
|
|
|
|
|
//llinfos << "Starting transfer for " << uuid << llendl;
|
|
|
|
|
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(mUpstreamHost, LLTCT_ASSET);
|
|
|
|
|
ttcp->requestTransfer(spa, tpvf, 100.f + (is_priority ? 1.f : 0.f));
|
|
|
|
|
}
|
|
|
|
|
@@ -539,6 +603,8 @@ void LLAssetStorage::downloadCompleteCallback(
|
|
|
|
|
LLAssetType::EType file_type,
|
|
|
|
|
void* user_data, LLExtStat ext_status)
|
|
|
|
|
{
|
|
|
|
|
llinfos << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl;
|
|
|
|
|
|
|
|
|
|
lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id
|
|
|
|
|
<< "," << LLAssetType::lookup(file_type) << llendl;
|
|
|
|
|
LLAssetRequest* req = (LLAssetRequest*)user_data;
|
|
|
|
|
@@ -627,11 +693,27 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Try static VFS first.
|
|
|
|
|
if (findInStaticVFSAndInvokeCallback(asset_id,atype,callback,user_data))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOL exists = mVFS->getExists(asset_id, atype);
|
|
|
|
|
LLVFile file(mVFS, asset_id, atype);
|
|
|
|
|
U32 size = exists ? file.getSize() : 0;
|
|
|
|
|
|
|
|
|
|
if (size < 1)
|
|
|
|
|
if (size > 0)
|
|
|
|
|
{
|
|
|
|
|
// we've already got the file
|
|
|
|
|
// theoretically, partial files w/o a pending request shouldn't happen
|
|
|
|
|
// unless there's a weird error
|
|
|
|
|
if (callback)
|
|
|
|
|
{
|
|
|
|
|
callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (exists)
|
|
|
|
|
{
|
|
|
|
|
@@ -682,16 +764,6 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// we've already got the file
|
|
|
|
|
// theoretically, partial files w/o a pending request shouldn't happen
|
|
|
|
|
// unless there's a weird error
|
|
|
|
|
if (callback)
|
|
|
|
|
{
|
|
|
|
|
callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LLAssetStorage::downloadEstateAssetCompleteCallback(
|
|
|
|
|
@@ -758,6 +830,12 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
|
|
|
|
|
|
|
|
|
|
if(asset_id.notNull())
|
|
|
|
|
{
|
|
|
|
|
// Try static VFS first.
|
|
|
|
|
if (findInStaticVFSAndInvokeCallback( asset_id, atype, callback, user_data))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exists = mVFS->getExists(asset_id, atype);
|
|
|
|
|
LLVFile file(mVFS, asset_id, atype);
|
|
|
|
|
size = exists ? file.getSize() : 0;
|
|
|
|
|
@@ -769,7 +847,17 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (size < 1)
|
|
|
|
|
if (size > 0)
|
|
|
|
|
{
|
|
|
|
|
// we've already got the file
|
|
|
|
|
// theoretically, partial files w/o a pending request shouldn't happen
|
|
|
|
|
// unless there's a weird error
|
|
|
|
|
if (callback)
|
|
|
|
|
{
|
|
|
|
|
callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// See whether we should talk to the object's originating sim,
|
|
|
|
|
// or the upstream provider.
|
|
|
|
|
@@ -818,16 +906,6 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// we've already got the file
|
|
|
|
|
// theoretically, partial files w/o a pending request shouldn't happen
|
|
|
|
|
// unless there's a weird error
|
|
|
|
|
if (callback)
|
|
|
|
|
{
|
|
|
|
|
callback(mVFS, asset_id, atype, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|