MAINT-7195 work (can't repro), removed UDP fetching path, handle more possible timing issues while connecting to region

master
Brad Payne (Vir Linden) 2017-03-20 16:04:02 -04:00
parent 6fb4bb4ed6
commit 17384ce6c4
7 changed files with 72 additions and 241 deletions

View File

@ -51,8 +51,7 @@ struct AssetEntry : public LLDictionaryEntry
mHumanName(human_name),
mCanLink(can_link),
mCanFetch(can_fetch),
mCanKnow(can_know),
mFetchWithVACap(false)
mCanKnow(can_know)
{
llassert(strlen(mTypeName) <= 8);
}
@ -62,7 +61,6 @@ struct AssetEntry : public LLDictionaryEntry
bool mCanLink;
bool mCanFetch;
bool mCanKnow;
bool mFetchWithVACap;
};
class LLAssetDictionary : public LLSingleton<LLAssetDictionary>,
@ -256,89 +254,3 @@ bool LLAssetType::lookupIsAssetIDKnowable(EType asset_type)
}
return false;
}
// static
bool LLAssetType::lookupFetchWithVACap(EType asset_type)
{
LLAssetDictionary *dict = LLAssetDictionary::getInstance();
const AssetEntry *entry = dict->lookup(asset_type);
if (entry)
{
return entry->mFetchWithVACap;
}
return false;
}
// FIXME asset-http yank all this after asset-http becomes universal
void LLAssetType::setFetchWithVACapTypeString(const std::string& type_string)
{
LLAssetDictionary *dict = LLAssetDictionary::getInstance();
if (type_string=="none")
{
for (LLAssetDictionary::iterator iter = dict->begin();
iter != dict->end();
iter++)
{
AssetEntry *entry = iter->second;
entry->mFetchWithVACap = false;
}
}
else if (type_string=="all")
{
for (LLAssetDictionary::iterator iter = dict->begin();
iter != dict->end();
iter++)
{
AssetEntry *entry = iter->second;
entry->mFetchWithVACap = true;
}
}
else
{
for (LLAssetDictionary::iterator iter = dict->begin();
iter != dict->end();
iter++)
{
AssetEntry *entry = iter->second;
if (entry->mTypeName==type_string)
{
entry->mFetchWithVACap = true;
}
}
}
}
// FIXME asset-http yank all this after asset-http becomes universal
void LLAssetType::setFetchWithVACapConfigString(const std::string& config_string)
{
// Clear any currently enabled types
LLAssetType::setFetchWithVACapTypeString("none");
// Enable all types specified in the config string.
std::set<std::string> type_names_for_va_cap;
boost::split(type_names_for_va_cap, config_string, boost::is_any_of(" :,"));
for (std::set<std::string>::const_iterator it = type_names_for_va_cap.begin();
it != type_names_for_va_cap.end(); ++it)
{
const std::string& type_string = *it;
LLAssetType::setFetchWithVACapTypeString(type_string);
}
LLAssetDictionary *dict = LLAssetDictionary::getInstance();
bool any_found = false;
for (LLAssetDictionary::iterator iter = dict->begin();
iter != dict->end();
iter++)
{
AssetEntry *entry = iter->second;
if (entry->mFetchWithVACap)
{
any_found = true;
LL_WARNS() << "Fetch with ViewerAsset cap enabled for " << entry->mTypeName << LL_ENDL;
}
}
if (!any_found)
{
LL_WARNS() << "Fetch with ViewerAsset cap disabled for all types" << LL_ENDL;
}
}

View File

@ -153,11 +153,6 @@ public:
static bool lookupIsAssetFetchByIDAllowed(EType asset_type); // the asset allows direct download
static bool lookupIsAssetIDKnowable(EType asset_type); // asset data can be known by the viewer
static bool lookupFetchWithVACap(EType asset_type); // asset data is fetched via http using ViewerAsset cap.
static void setFetchWithVACapTypeString(const std::string& type_string);
static void setFetchWithVACapConfigString(const std::string& config_string);
static const std::string& badLookup(); // error string when a lookup fails
protected:

View File

@ -15808,18 +15808,6 @@
<integer>0</integer>
</map>
<key>ViewerAssetHttpTypes</key>
<map>
<key>Comment</key>
<string>Use the ViewerAsset cap and HTTP pipeline for fetching assets of the listed type names. "none" and "all" are recognized as a special values.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>all</string>
</map>
<key>SimulateFBOFailure</key>
<map>
<key>Comment</key>

View File

@ -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;

View File

@ -42,6 +42,7 @@
#include "llcoros.h"
#include "lleventcoro.h"
#include "llsdutil.h"
#include "llworld.h"
///----------------------------------------------------------------------------
/// LLViewerAssetRequest
@ -350,73 +351,7 @@ 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);
}
}
void LLViewerAssetStorage::queueRequestUDP(
const LLUUID& uuid,
LLAssetType::EType atype,
LLGetAssetCallback callback,
void *user_data,
BOOL duplicate,
BOOL is_priority)
{
LL_DEBUGS("ViewerAsset") << "Request asset via UDP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL;
if (mUpstreamHost.isOk())
{
// 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);
}
}
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, uuid, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM);
}
}
queueRequestHttp(uuid, atype, callback, user_data, duplicate, is_priority);
}
void LLViewerAssetStorage::queueRequestHttp(
@ -428,48 +363,40 @@ void LLViewerAssetStorage::queueRequestHttp(
BOOL is_priority)
{
LL_DEBUGS("ViewerAsset") << "Request asset via HTTP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL;
if (!gAgent.getRegion())
{
LL_WARNS() << "No region, fetch fails" << LL_ENDL;
return;
}
std::string cap_url = gAgent.getRegion()->getCapability("ViewerAsset");
if (cap_url.empty())
{
LL_WARNS() << "No ViewerAsset cap found, fetch fails" << LL_ENDL;
// TODO asset-http: handle waiting for caps? Other failure mechanism?
return;
}
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)
{
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);
bool is_temp = false;
LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp);
// This is the same as the current UDP logic - don't re-request a duplicate.
if (!duplicate)
{
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));
}
LLCoros::instance().launch("LLViewerAssetStorage::assetRequestCoro",
boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data));
}
}
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,
@ -477,7 +404,42 @@ void LLViewerAssetStorage::assetRequestCoro(
LLGetAssetCallback callback,
void *user_data)
{
std::string url = getAssetURL(uuid,atype);
S32 result_code = LL_ERR_NOERR;
LLExtStat ext_status = LL_EXSTAT_NONE;
if (!gAgent.getRegion())
{
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;
}
else if (!gAgent.getRegion()->capabilitiesReceived())
{
LLEventStream capsRecv("waitForCaps", true);
gAgent.getRegion()->setCapabilitiesReceivedCallback(
boost::bind(&LLViewerAssetStorage::capsRecvForRegion, this, _1, capsRecv.getName()));
llcoro::suspendUntilEventOn(capsRecv);
}
else
{
if (mViewerAssetUrl.empty())
{
mViewerAssetUrl = gAgent.getRegion()->getViewerAssetUrl();
}
}
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;

View File

@ -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

View File

@ -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