本文整理汇总了C++中LLTransferTargetParamsVFile::setCallback方法的典型用法代码示例。如果您正苦于以下问题:C++ LLTransferTargetParamsVFile::setCallback方法的具体用法?C++ LLTransferTargetParamsVFile::setCallback怎么用?C++ LLTransferTargetParamsVFile::setCallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLTransferTargetParamsVFile
的用法示例。
在下文中一共展示了LLTransferTargetParamsVFile::setCallback方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _queueDataRequest
//
// *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)
{
add(sFailedDownloadCount, 1);
callback(mVFS, uuid, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
}
}
}
示例2: getInvItemAsset
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)
{
lldebugs << "LLAssetStorage::getInvItemAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << llendl;
//
// 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;
if(asset_id.notNull())
{
exists = mVFS->getExists(asset_id, atype);
LLVFile file(mVFS, asset_id, atype);
size = exists ? file.getSize() : 0;
if(exists && size < 1)
{
llwarns << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << llendl;
file.remove();
}
}
if (size < 1)
{
// See whether we should talk to the object's originating sim,
// or the upstream provider.
LLHost source_host;
if (object_sim.isOk())
{
source_host = object_sim;
}
else
{
source_host = mUpstreamHost;
}
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;
// send request message to our upstream data provider
// Create a new asset transfer.
LLTransferSourceParamsInvItem spi;
spi.setAgentSession(agent_id, session_id);
spi.setInvItem(owner_id, task_id, item_id);
spi.setAsset(asset_id, atype);
// Set our destination file, and the completion callback.
LLTransferTargetParamsVFile tpvf;
tpvf.setAsset(asset_id, atype);
tpvf.setCallback(downloadInvItemCompleteCallback, req);
llinfos << "Starting transfer for inventory asset "
<< item_id << " owned by " << owner_id << "," << task_id
<< llendl;
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET);
ttcp->requestTransfer(spi, tpvf, 100.f + (is_priority ? 1.f : 0.f));
}
else
{
// uh-oh, we shouldn't have gotten here
llwarns << "Attempt to move asset data request upstream w/o valid upstream provider" << llendl;
if (callback)
{
callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
}
}
}
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);
}
}
}
示例3: getEstateAsset
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;
//
// 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, LL_EXSTAT_NULL_UUID);
}
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 > 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)
{
LL_WARNS() << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
file.remove();
}
// See whether we should talk to the object's originating sim, or the upstream provider.
LLHost source_host;
if (object_sim.isOk())
{
source_host = object_sim;
}
else
{
source_host = mUpstreamHost;
}
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;
// send request message to our upstream data provider
// Create a new asset transfer.
LLTransferSourceParamsEstate spe;
spe.setAgentSession(agent_id, session_id);
spe.setEstateAssetType(etype);
// Set our destination file, and the completion callback.
LLTransferTargetParamsVFile tpvf;
tpvf.setAsset(asset_id, atype);
tpvf.setCallback(downloadEstateAssetCompleteCallback, req);
LL_DEBUGS("AssetStorage") << "Starting transfer for " << asset_id << LL_ENDL;
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET);
ttcp->requestTransfer(spe, 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, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
}
}
}
}