parent
6b88a2bec2
commit
7fc9c0baa4
|
|
@ -585,7 +585,8 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,
|
|||
// 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)
|
||||
S32 result_code, LLExtStat ext_status,
|
||||
S32 bytes_fetched)
|
||||
{
|
||||
// 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,
|
||||
|
|
@ -598,6 +599,10 @@ void LLAssetStorage::removeAndCallbackPendingDownloads(const LLUUID& file_id, LL
|
|||
LLAssetRequest* tmp = *curiter;
|
||||
if ((tmp->getUUID() == file_id) && (tmp->getType()== file_type))
|
||||
{
|
||||
if (bytes_fetched > 0)
|
||||
{
|
||||
tmp->mBytesFetched = bytes_fetched;
|
||||
}
|
||||
requests.push_front(tmp);
|
||||
iter = gAssetStorage->mPendingDownloads.erase(curiter);
|
||||
}
|
||||
|
|
@ -664,6 +669,7 @@ void LLAssetStorage::downloadCompleteCallback(
|
|||
callback_type = req->getType();
|
||||
}
|
||||
|
||||
S32 bytes_fetched = 0;
|
||||
if (LL_ERR_NOERR == result)
|
||||
{
|
||||
// we might have gotten a zero-size file
|
||||
|
|
@ -677,21 +683,11 @@ void LLAssetStorage::downloadCompleteCallback(
|
|||
}
|
||||
else
|
||||
{
|
||||
#if 1
|
||||
for (request_list_t::iterator iter = gAssetStorage->mPendingDownloads.begin();
|
||||
iter != gAssetStorage->mPendingDownloads.end(); ++iter )
|
||||
{
|
||||
LLAssetRequest* dlreq = *iter;
|
||||
if ((dlreq->getUUID() == file_id) && (dlreq->getType()== file_type))
|
||||
{
|
||||
dlreq->mBytesFetched = vfile.getSize();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
bytes_fetched = vfile.getSize();
|
||||
}
|
||||
}
|
||||
|
||||
removeAndCallbackPendingDownloads(file_id, file_type, callback_id, callback_type, result, ext_status);
|
||||
removeAndCallbackPendingDownloads(file_id, file_type, callback_id, callback_type, result, ext_status, bytes_fetched);
|
||||
}
|
||||
|
||||
void LLAssetStorage::getEstateAsset(
|
||||
|
|
|
|||
|
|
@ -324,7 +324,8 @@ public:
|
|||
|
||||
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);
|
||||
S32 result_code, LLExtStat ext_status,
|
||||
S32 bytes_fetched);
|
||||
|
||||
// download process callbacks
|
||||
static void downloadCompleteCallback(
|
||||
|
|
|
|||
|
|
@ -402,10 +402,10 @@ void LLViewerAssetStorage::queueRequestHttp(
|
|||
manager->enqueueCoprocedure(
|
||||
VIEWER_ASSET_STORAGE_CORO_POOL,
|
||||
"LLViewerAssetStorage::assetRequestCoro",
|
||||
[this, req, uuid, atype, callback, user_data]
|
||||
[this, uuid, atype, callback, user_data]
|
||||
(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t&, const LLUUID&)
|
||||
{
|
||||
assetRequestCoro(req, uuid, atype, callback, user_data);
|
||||
assetRequestCoro(uuid, atype, callback, user_data);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -440,7 +440,6 @@ struct LLScopedIncrement
|
|||
};
|
||||
|
||||
void LLViewerAssetStorage::assetRequestCoro(
|
||||
LLViewerAssetRequest *req,
|
||||
const LLUUID uuid,
|
||||
LLAssetType::EType atype,
|
||||
LLGetAssetCallback callback,
|
||||
|
|
@ -464,7 +463,7 @@ void LLViewerAssetStorage::assetRequestCoro(
|
|||
LL_WARNS_ONCE("ViewerAsset") << "Asset request fails: no region set" << LL_ENDL;
|
||||
result_code = LL_ERR_ASSET_REQUEST_FAILED;
|
||||
ext_status = LLExtStat::NONE;
|
||||
removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status);
|
||||
removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status, 0);
|
||||
return;
|
||||
}
|
||||
else if (!gAgent.getRegion()->capabilitiesReceived())
|
||||
|
|
@ -495,7 +494,7 @@ void LLViewerAssetStorage::assetRequestCoro(
|
|||
LL_WARNS_ONCE("ViewerAsset") << "asset request fails: caps received but no viewer asset cap found" << LL_ENDL;
|
||||
result_code = LL_ERR_ASSET_REQUEST_FAILED;
|
||||
ext_status = LLExtStat::NONE;
|
||||
removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status);
|
||||
removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status, 0);
|
||||
return;
|
||||
}
|
||||
std::string url = getAssetURL(mViewerAssetUrl, uuid,atype);
|
||||
|
|
@ -517,6 +516,7 @@ void LLViewerAssetStorage::assetRequestCoro(
|
|||
|
||||
mCountCompleted++;
|
||||
|
||||
S32 bytes_fetched = 0;
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
if (!status)
|
||||
|
|
@ -554,7 +554,7 @@ void LLViewerAssetStorage::assetRequestCoro(
|
|||
LLUUID temp_id;
|
||||
temp_id.generate();
|
||||
LLFileSystem vf(temp_id, atype, LLFileSystem::WRITE);
|
||||
req->mBytesFetched = size;
|
||||
bytes_fetched = size;
|
||||
if (!vf.write(raw.data(),size))
|
||||
{
|
||||
// TODO asset-http: handle error
|
||||
|
|
@ -583,7 +583,7 @@ void LLViewerAssetStorage::assetRequestCoro(
|
|||
}
|
||||
|
||||
// Clean up pending downloads and trigger callbacks
|
||||
removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status);
|
||||
removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status, bytes_fetched);
|
||||
}
|
||||
|
||||
std::string LLViewerAssetStorage::getAssetURL(const std::string& cap_url, const LLUUID& uuid, LLAssetType::EType atype)
|
||||
|
|
|
|||
|
|
@ -82,8 +82,7 @@ protected:
|
|||
|
||||
void capsRecvForRegion(const LLUUID& region_id, std::string pumpname);
|
||||
|
||||
void assetRequestCoro(LLViewerAssetRequest *req,
|
||||
const LLUUID uuid,
|
||||
void assetRequestCoro(const LLUUID uuid,
|
||||
LLAssetType::EType atype,
|
||||
LLGetAssetCallback callback,
|
||||
void *user_data);
|
||||
|
|
|
|||
Loading…
Reference in New Issue