From 17384ce6c43a9e07031d7deeea4ec9bbee76199c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 20 Mar 2017 16:04:02 -0400 Subject: MAINT-7195 work (can't repro), removed UDP fetching path, handle more possible timing issues while connecting to region --- indra/newview/app_settings/settings.xml | 12 --- indra/newview/llstartup.cpp | 10 -- indra/newview/llviewerassetstorage.cpp | 162 ++++++++++++-------------------- indra/newview/llviewerassetstorage.h | 12 +-- indra/newview/llviewercontrol.cpp | 8 -- 5 files changed, 64 insertions(+), 140 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9b26053fb5..717deba8c7 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -15808,18 +15808,6 @@ 0 - ViewerAssetHttpTypes - - Comment - Use the ViewerAsset cap and HTTP pipeline for fetching assets of the listed type names. "none" and "all" are recognized as a special values. - Persist - 1 - Type - String - Value - all - - SimulateFBOFailure Comment diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 0ef337b6c4..b762b2ae1c 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -312,16 +312,6 @@ void set_flags_and_update_appearance() // true when all initialization done. bool idle_startup() { - // FIXME asset-http - this configuration stuff is temporary - // construction; once it is always on for certain types - // we can remove the setting. - static bool va_types_initialized = false; - if (!va_types_initialized) - { - va_types_initialized = true; - LLAssetType::setFetchWithVACapConfigString(gSavedSettings.getString("ViewerAssetHttpTypes")); - } - const F32 PRECACHING_DELAY = gSavedSettings.getF32("PrecachingDelay"); static LLTimer timeout; diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 496fbbecff..cb60337a7f 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -42,6 +42,7 @@ #include "llcoros.h" #include "lleventcoro.h" #include "llsdutil.h" +#include "llworld.h" ///---------------------------------------------------------------------------- /// LLViewerAssetRequest @@ -350,17 +351,10 @@ void LLViewerAssetStorage::_queueDataRequest( BOOL duplicate, BOOL is_priority) { - if (LLAssetType::lookupFetchWithVACap(atype)) - { - queueRequestHttp(uuid, atype, callback, user_data, duplicate, is_priority); - } - else - { - queueRequestUDP(uuid, atype, callback, user_data, duplicate, is_priority); - } + queueRequestHttp(uuid, atype, callback, user_data, duplicate, is_priority); } -void LLViewerAssetStorage::queueRequestUDP( +void LLViewerAssetStorage::queueRequestHttp( const LLUUID& uuid, LLAssetType::EType atype, LLGetAssetCallback callback, @@ -368,116 +362,84 @@ void LLViewerAssetStorage::queueRequestUDP( BOOL duplicate, BOOL is_priority) { - LL_DEBUGS("ViewerAsset") << "Request asset via UDP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL; + LL_DEBUGS("ViewerAsset") << "Request asset via HTTP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL; - if (mUpstreamHost.isOk()) + bool with_http = true; + LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype, with_http); + req->mDownCallback = callback; + req->mUserData = user_data; + req->mIsPriority = is_priority; + if (!duplicate) { - // 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, with_http); - req->mDownCallback = callback; - req->mUserData = user_data; - req->mIsPriority = is_priority; - if (!duplicate) - { - // Only collect metrics for non-duplicate requests. Others - // are piggy-backing and will artificially lower averages. - req->mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp(); - } - - 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_DEBUGS("AssetStorage") << "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)); - - bool with_http = false; - bool is_temp = false; - LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); - } + // Only collect metrics for non-duplicate requests. Others + // are piggy-backing and will artificially lower averages. + req->mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp(); } - else + mPendingDownloads.push_back(req); + + // This is the same as the current UDP logic - don't re-request a duplicate. + if (!duplicate) { - // 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); - } + bool with_http = true; + bool is_temp = false; + LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); + + LLCoros::instance().launch("LLViewerAssetStorage::assetRequestCoro", + boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data)); } } -void LLViewerAssetStorage::queueRequestHttp( +void LLViewerAssetStorage::capsRecvForRegion(const LLUUID& region_id, std::string pumpname) +{ + LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(region_id); + mViewerAssetUrl = regionp->getViewerAssetUrl(); + + LLEventPumps::instance().obtain(pumpname).post(LLSD()); +} + +void LLViewerAssetStorage::assetRequestCoro( + LLViewerAssetRequest *req, const LLUUID& uuid, LLAssetType::EType atype, LLGetAssetCallback callback, - void *user_data, - BOOL duplicate, - BOOL is_priority) + void *user_data) { - LL_DEBUGS("ViewerAsset") << "Request asset via HTTP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL; + S32 result_code = LL_ERR_NOERR; + LLExtStat ext_status = LL_EXSTAT_NONE; + if (!gAgent.getRegion()) { - LL_WARNS() << "No region, fetch fails" << LL_ENDL; + LL_WARNS_ONCE() << "Asset request fails: no region set" << LL_ENDL; + result_code = LL_ERR_ASSET_REQUEST_FAILED; + ext_status = LL_EXSTAT_NONE; + removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status); return; } - std::string cap_url = gAgent.getRegion()->getCapability("ViewerAsset"); - if (cap_url.empty()) + else if (!gAgent.getRegion()->capabilitiesReceived()) { - LL_WARNS() << "No ViewerAsset cap found, fetch fails" << LL_ENDL; - // TODO asset-http: handle waiting for caps? Other failure mechanism? - return; + LLEventStream capsRecv("waitForCaps", true); + + gAgent.getRegion()->setCapabilitiesReceivedCallback( + boost::bind(&LLViewerAssetStorage::capsRecvForRegion, this, _1, capsRecv.getName())); + + llcoro::suspendUntilEventOn(capsRecv); } else { - LL_DEBUGS("ViewerAsset") << "Will fetch via ViewerAsset cap " << cap_url << LL_ENDL; - - bool with_http = true; - LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype, with_http); - req->mDownCallback = callback; - req->mUserData = user_data; - req->mIsPriority = is_priority; - if (!duplicate) - { - // Only collect metrics for non-duplicate requests. Others - // are piggy-backing and will artificially lower averages. - req->mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp(); - } - mPendingDownloads.push_back(req); - - // This is the same as the current UDP logic - don't re-request a duplicate. - if (!duplicate) + if (mViewerAssetUrl.empty()) { - bool with_http = true; - bool is_temp = false; - LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); - - LLCoros::instance().launch("LLViewerAssetStorage::assetRequestCoro", - boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data)); + mViewerAssetUrl = gAgent.getRegion()->getViewerAssetUrl(); } } -} - -void LLViewerAssetStorage::assetRequestCoro( - LLViewerAssetRequest *req, - const LLUUID& uuid, - LLAssetType::EType atype, - LLGetAssetCallback callback, - void *user_data) -{ - std::string url = getAssetURL(uuid,atype); + if (mViewerAssetUrl.empty()) + { + LL_WARNS_ONCE() << "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; + removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status); + return; + } + std::string url = getAssetURL(mViewerAssetUrl, uuid,atype); LL_DEBUGS("ViewerAsset") << "request url: " << url << LL_ENDL; LLCore::HttpRequest::policy_t httpPolicy(LLAppCoreHttp::AP_TEXTURE); @@ -488,9 +450,6 @@ void LLViewerAssetStorage::assetRequestCoro( LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts); - S32 result_code = LL_ERR_NOERR; - LLExtStat ext_status = LL_EXSTAT_NONE; - LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) @@ -542,9 +501,8 @@ void LLViewerAssetStorage::assetRequestCoro( removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status); } -std::string LLViewerAssetStorage::getAssetURL(const LLUUID& uuid, LLAssetType::EType atype) +std::string LLViewerAssetStorage::getAssetURL(const std::string& cap_url, const LLUUID& uuid, LLAssetType::EType atype) { - std::string cap_url = gAgent.getRegion()->getViewerAssetUrl(); std::string type_name = LLAssetType::lookup(atype); std::string url = cap_url + "/?" + type_name + "_id=" + uuid.asString(); return url; diff --git a/indra/newview/llviewerassetstorage.h b/indra/newview/llviewerassetstorage.h index 3ca8112601..2f3eaa15a7 100644 --- a/indra/newview/llviewerassetstorage.h +++ b/indra/newview/llviewerassetstorage.h @@ -73,13 +73,6 @@ protected: BOOL duplicate, 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); - void queueRequestHttp(const LLUUID& uuid, LLAssetType::EType type, void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), @@ -87,14 +80,17 @@ protected: BOOL duplicate, BOOL is_priority); + void capsRecvForRegion(const LLUUID& region_id, std::string pumpname); + void assetRequestCoro(LLViewerAssetRequest *req, const LLUUID& uuid, LLAssetType::EType atype, void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), void *user_data); - std::string getAssetURL(const LLUUID& uuid, LLAssetType::EType atype); + std::string getAssetURL(const std::string& cap_url, const LLUUID& uuid, LLAssetType::EType atype); + std::string mViewerAssetUrl; }; #endif diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index c0a87adca5..7c1921b143 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -127,13 +127,6 @@ static bool handleDebugAvatarJointsChanged(const LLSD& newvalue) return true; } -static bool handleViewerAssetHttpTypesChanged(const LLSD& newvalue) -{ - std::string new_string = newvalue.asString(); - LLAssetType::setFetchWithVACapConfigString(new_string); - return true; -} - static bool handleSetShaderChanged(const LLSD& newvalue) { // changing shader level may invalidate existing cached bump maps, as the shader type determines the format of the bump map it expects - clear and repopulate the bump cache @@ -757,7 +750,6 @@ void settings_setup_listeners() gSavedSettings.getControl("SpellCheckDictionary")->getSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("LoginLocation")->getSignal()->connect(boost::bind(&handleLoginLocationChanged)); gSavedSettings.getControl("DebugAvatarJoints")->getCommitSignal()->connect(boost::bind(&handleDebugAvatarJointsChanged, _2)); - gSavedSettings.getControl("ViewerAssetHttpTypes")->getCommitSignal()->connect(boost::bind(&handleViewerAssetHttpTypesChanged, _2)); } #if TEST_CACHED_CONTROL -- cgit v1.2.3