summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerassetstorage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerassetstorage.cpp')
-rw-r--r--indra/newview/llviewerassetstorage.cpp44
1 files changed, 30 insertions, 14 deletions
diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp
index e0b64403ef..cacdee7e83 100644
--- a/indra/newview/llviewerassetstorage.cpp
+++ b/indra/newview/llviewerassetstorage.cpp
@@ -49,6 +49,8 @@
/// LLViewerAssetRequest
///----------------------------------------------------------------------------
+static const std::string VIEWER_ASSET_STORAGE_CORO_POOL = "VAssetStorage";
+
/**
* @brief Local class to encapsulate asset fetch requests with a timestamp.
*
@@ -127,6 +129,15 @@ LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *
{
}
+LLViewerAssetStorage::~LLViewerAssetStorage()
+{
+ if (!LLCoprocedureManager::wasDeleted())
+ {
+ // This class has dedicated coroutine pool, clean it up, otherwise coroutines will crash later.
+ LLCoprocedureManager::instance().close(VIEWER_ASSET_STORAGE_CORO_POOL);
+ }
+}
+
// virtual
void LLViewerAssetStorage::storeAssetData(
const LLTransactionID& tid,
@@ -168,7 +179,7 @@ void LLViewerAssetStorage::storeAssetData(
delete req;
if (callback)
{
- callback(asset_id, user_data, LL_ERR_ASSET_REQUEST_FAILED, LL_EXSTAT_VFS_CORRUPT);
+ callback(asset_id, user_data, LL_ERR_ASSET_REQUEST_FAILED, LLExtStat::VFS_CORRUPT);
}
return;
}
@@ -209,7 +220,7 @@ void LLViewerAssetStorage::storeAssetData(
if (callback)
{
- callback(asset_id, user_data, LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE, LL_EXSTAT_VFS_CORRUPT);
+ callback(asset_id, user_data, LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE, LLExtStat::VFS_CORRUPT);
}
return;
}
@@ -236,7 +247,7 @@ void LLViewerAssetStorage::storeAssetData(
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)
{
- callback(asset_id, user_data, LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE, LL_EXSTAT_NONEXISTENT_FILE);
+ callback(asset_id, user_data, LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE, LLExtStat::NONEXISTENT_FILE);
}
}
}
@@ -247,7 +258,7 @@ void LLViewerAssetStorage::storeAssetData(
reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_NO_UPSTREAM, __FILE__, __LINE__, "No upstream provider" );
if (callback)
{
- callback(asset_id, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
+ callback(asset_id, user_data, LL_ERR_CIRCUIT_GONE, LLExtStat::NO_UPSTREAM);
}
}
}
@@ -333,7 +344,7 @@ void LLViewerAssetStorage::storeAssetData(
}
if (callback)
{
- callback(asset_id, user_data, LL_ERR_CANNOT_OPEN_FILE, LL_EXSTAT_BLOCKED_FILE);
+ callback(asset_id, user_data, LL_ERR_CANNOT_OPEN_FILE, LLExtStat::BLOCKED_FILE);
}
}
}
@@ -399,7 +410,7 @@ void LLViewerAssetStorage::queueRequestHttp(
bool is_temp = false;
LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp);
- LLCoprocedureManager::instance().enqueueCoprocedure("AssetStorage","LLViewerAssetStorage::assetRequestCoro",
+ LLCoprocedureManager::instance().enqueueCoprocedure(VIEWER_ASSET_STORAGE_CORO_POOL,"LLViewerAssetStorage::assetRequestCoro",
boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data));
}
}
@@ -444,13 +455,18 @@ void LLViewerAssetStorage::assetRequestCoro(
mCountStarted++;
S32 result_code = LL_ERR_NOERR;
- LLExtStat ext_status = LL_EXSTAT_NONE;
+ LLExtStat ext_status = LLExtStat::NONE;
+ if (!gAssetStorage)
+ {
+ LL_WARNS_ONCE("ViewerAsset") << "Asset request fails: asset storage no longer exists" << LL_ENDL;
+ return;
+ }
if (!gAgent.getRegion())
{
LL_WARNS_ONCE("ViewerAsset") << "Asset request fails: no region set" << LL_ENDL;
result_code = LL_ERR_ASSET_REQUEST_FAILED;
- ext_status = LL_EXSTAT_NONE;
+ ext_status = LLExtStat::NONE;
removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status);
return;
}
@@ -475,7 +491,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 = LL_EXSTAT_NONE;
+ ext_status = LLExtStat::NONE;
removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status);
return;
}
@@ -490,7 +506,7 @@ void LLViewerAssetStorage::assetRequestCoro(
LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts);
- if (LLApp::isQuitting())
+ if (LLApp::isQuitting() || !gAssetStorage)
{
// Bail out if result arrives after shutdown has been started.
return;
@@ -504,7 +520,7 @@ void LLViewerAssetStorage::assetRequestCoro(
{
LL_DEBUGS("ViewerAsset") << "request failed, status " << status.toTerseString() << LL_ENDL;
result_code = LL_ERR_ASSET_REQUEST_FAILED;
- ext_status = LL_EXSTAT_NONE;
+ ext_status = LLExtStat::NONE;
}
else
{
@@ -530,13 +546,13 @@ void LLViewerAssetStorage::assetRequestCoro(
// TODO asset-http: handle error
LL_WARNS("ViewerAsset") << "Failure in vf.write()" << LL_ENDL;
result_code = LL_ERR_ASSET_REQUEST_FAILED;
- ext_status = LL_EXSTAT_VFS_CORRUPT;
+ ext_status = LLExtStat::VFS_CORRUPT;
}
else if (!vf.rename(uuid, atype))
{
LL_WARNS("ViewerAsset") << "rename failed" << LL_ENDL;
result_code = LL_ERR_ASSET_REQUEST_FAILED;
- ext_status = LL_EXSTAT_VFS_CORRUPT;
+ ext_status = LLExtStat::VFS_CORRUPT;
}
else
{
@@ -548,7 +564,7 @@ void LLViewerAssetStorage::assetRequestCoro(
// TODO asset-http: handle invalid size case
LL_WARNS("ViewerAsset") << "bad size" << LL_ENDL;
result_code = LL_ERR_ASSET_REQUEST_FAILED;
- ext_status = LL_EXSTAT_NONE;
+ ext_status = LLExtStat::NONE;
}
}