From 5db5f6148aad0f5e561012f0ec9d1a62b8e54a19 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 13 Feb 2017 14:32:50 -0500 Subject: SL-409 - initial cleanup, mostly indentation fixes and removing unused or inaccessible code --- indra/newview/llviewerassetstorage.cpp | 575 +++++++++++++++++---------------- 1 file changed, 289 insertions(+), 286 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 2db9c7e67c..b5e68c0617 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -33,6 +33,9 @@ #include "message.h" #include "llagent.h" + +// FIXME asset-http: We are the only customer for gTransferManager - the +// whole class can be yanked once everything is http-ified. #include "lltransfersourceasset.h" #include "lltransfertargetvfile.h" #include "llviewerassetstats.h" @@ -51,38 +54,38 @@ class LLViewerAssetRequest : public LLAssetRequest { public: - LLViewerAssetRequest(const LLUUID &uuid, const LLAssetType::EType type) - : LLAssetRequest(uuid, type), - mMetricsStartTime(0) - { - } - - LLViewerAssetRequest & operator=(const LLViewerAssetRequest &); // Not defined - // Default assignment operator valid - - // virtual - ~LLViewerAssetRequest() - { - recordMetrics(); - } + LLViewerAssetRequest(const LLUUID &uuid, const LLAssetType::EType type) + : LLAssetRequest(uuid, type), + mMetricsStartTime(0) + { + } + + LLViewerAssetRequest & operator=(const LLViewerAssetRequest &); // Not defined + // Default assignment operator valid + + // virtual + ~LLViewerAssetRequest() + { + recordMetrics(); + } protected: - void recordMetrics() - { - if (mMetricsStartTime.value()) - { - // Okay, it appears this request was used for useful things. Record - // the expected dequeue and duration of request processing. - LLViewerAssetStatsFF::record_dequeue(mType, false, false); - LLViewerAssetStatsFF::record_response(mType, false, false, - (LLViewerAssetStatsFF::get_timestamp() - - mMetricsStartTime)); - mMetricsStartTime = (U32Seconds)0; - } - } - + void recordMetrics() + { + if (mMetricsStartTime.value()) + { + // Okay, it appears this request was used for useful things. Record + // the expected dequeue and duration of request processing. + LLViewerAssetStatsFF::record_dequeue(mType, false, false); + LLViewerAssetStatsFF::record_response(mType, false, false, + (LLViewerAssetStatsFF::get_timestamp() + - mMetricsStartTime)); + mMetricsStartTime = (U32Seconds)0; + } + } + public: - LLViewerAssetStats::duration_t mMetricsStartTime; + LLViewerAssetStats::duration_t mMetricsStartTime; }; ///---------------------------------------------------------------------------- @@ -90,228 +93,228 @@ public: ///---------------------------------------------------------------------------- LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, - LLVFS *vfs, LLVFS *static_vfs, - const LLHost &upstream_host) - : LLAssetStorage(msg, xfer, vfs, static_vfs, upstream_host) + LLVFS *vfs, LLVFS *static_vfs, + const LLHost &upstream_host) + : LLAssetStorage(msg, xfer, vfs, static_vfs, upstream_host) { } LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, - LLVFS *vfs, LLVFS *static_vfs) - : LLAssetStorage(msg, xfer, vfs, static_vfs) + LLVFS *vfs, LLVFS *static_vfs) + : LLAssetStorage(msg, xfer, vfs, static_vfs) { } // virtual void LLViewerAssetStorage::storeAssetData( - const LLTransactionID& tid, - LLAssetType::EType asset_type, - LLStoreAssetCallback callback, - void* user_data, - bool temp_file, - bool is_priority, - bool store_local, - bool user_waiting, - F64Seconds timeout) + const LLTransactionID& tid, + LLAssetType::EType asset_type, + LLStoreAssetCallback callback, + void* user_data, + bool temp_file, + bool is_priority, + bool store_local, + bool user_waiting, + F64Seconds timeout) { - LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy) " << tid << ":" << LLAssetType::lookup(asset_type) - << " ASSET_ID: " << asset_id << LL_ENDL; - - if (mUpstreamHost.isOk()) - { - if (mVFS->getExists(asset_id, asset_type)) - { - // Pack data into this packet if we can fit it. - U8 buffer[MTUBYTES]; - buffer[0] = 0; - - LLVFile vfile(mVFS, asset_id, asset_type, LLVFile::READ); - S32 asset_size = vfile.getSize(); - - LLAssetRequest *req = new LLAssetRequest(asset_id, asset_type); - req->mUpCallback = callback; - req->mUserData = user_data; - - if (asset_size < 1) - { - // This can happen if there's a bug in our code or if the VFS has been corrupted. - LL_WARNS() << "LLViewerAssetStorage::storeAssetData() Data _should_ already be in the VFS, but it's not! " << asset_id << LL_ENDL; - // LLAssetStorage metric: Zero size VFS - 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)" ); - - delete req; - if (callback) - { - callback(asset_id, user_data, LL_ERR_ASSET_REQUEST_FAILED, LL_EXSTAT_VFS_CORRUPT); - } - return; - } - else - { - // LLAssetStorage metric: Successful Request - S32 size = mVFS->getSize(asset_id, asset_type); - const char *message = "Added to upload queue"; - reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, size, MR_OKAY, __FILE__, __LINE__, message ); - - if(is_priority) - { - mPendingUploads.push_front(req); - } - else - { - mPendingUploads.push_back(req); - } - } - - // Read the data from the VFS if it'll fit in this packet. - if (asset_size + 100 < MTUBYTES) - { - BOOL res = vfile.read(buffer, asset_size); /* Flawfinder: ignore */ - S32 bytes_read = res ? vfile.getLastBytesRead() : 0; - - if( bytes_read == asset_size ) - { - req->mDataSentInFirstPacket = TRUE; - //LL_INFOS() << "LLViewerAssetStorage::createAsset sending data in first packet" << LL_ENDL; - } - else - { - LL_WARNS() << "Probable corruption in VFS file, aborting store asset data" << LL_ENDL; - - // LLAssetStorage metric: VFS corrupt - bogus size - reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, asset_size, MR_VFS_CORRUPTION, __FILE__, __LINE__, "VFS corruption" ); - - if (callback) - { - callback(asset_id, user_data, LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE, LL_EXSTAT_VFS_CORRUPT); - } - return; - } - } - else - { - // Too big, do an xfer - buffer[0] = 0; - asset_size = 0; - } - mMessageSys->newMessageFast(_PREHASH_AssetUploadRequest); - mMessageSys->nextBlockFast(_PREHASH_AssetBlock); - mMessageSys->addUUIDFast(_PREHASH_TransactionID, tid); - mMessageSys->addS8Fast(_PREHASH_Type, (S8)asset_type); - mMessageSys->addBOOLFast(_PREHASH_Tempfile, temp_file); - mMessageSys->addBOOLFast(_PREHASH_StoreLocal, store_local); - mMessageSys->addBinaryDataFast( _PREHASH_AssetData, buffer, asset_size ); - mMessageSys->sendReliable(mUpstreamHost); - } - else - { - LL_WARNS() << "AssetStorage: attempt to upload non-existent vfile " << asset_id << ":" << LLAssetType::lookup(asset_type) << LL_ENDL; - // LLAssetStorage metric: Zero size VFS - 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); - } - } - } - else - { - LL_WARNS() << "Attempt to move asset store request upstream w/o valid upstream provider" << LL_ENDL; - // LLAssetStorage metric: Upstream provider dead - 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); - } - } + LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); + LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy) " << tid << ":" << LLAssetType::lookup(asset_type) + << " ASSET_ID: " << asset_id << LL_ENDL; + + if (mUpstreamHost.isOk()) + { + if (mVFS->getExists(asset_id, asset_type)) + { + // Pack data into this packet if we can fit it. + U8 buffer[MTUBYTES]; + buffer[0] = 0; + + LLVFile vfile(mVFS, asset_id, asset_type, LLVFile::READ); + S32 asset_size = vfile.getSize(); + + LLAssetRequest *req = new LLAssetRequest(asset_id, asset_type); + req->mUpCallback = callback; + req->mUserData = user_data; + + if (asset_size < 1) + { + // This can happen if there's a bug in our code or if the VFS has been corrupted. + LL_WARNS() << "LLViewerAssetStorage::storeAssetData() Data _should_ already be in the VFS, but it's not! " << asset_id << LL_ENDL; + // LLAssetStorage metric: Zero size VFS + 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)" ); + + delete req; + if (callback) + { + callback(asset_id, user_data, LL_ERR_ASSET_REQUEST_FAILED, LL_EXSTAT_VFS_CORRUPT); + } + return; + } + else + { + // LLAssetStorage metric: Successful Request + S32 size = mVFS->getSize(asset_id, asset_type); + const char *message = "Added to upload queue"; + reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, size, MR_OKAY, __FILE__, __LINE__, message ); + + if(is_priority) + { + mPendingUploads.push_front(req); + } + else + { + mPendingUploads.push_back(req); + } + } + + // Read the data from the VFS if it'll fit in this packet. + if (asset_size + 100 < MTUBYTES) + { + BOOL res = vfile.read(buffer, asset_size); /* Flawfinder: ignore */ + S32 bytes_read = res ? vfile.getLastBytesRead() : 0; + + if( bytes_read == asset_size ) + { + req->mDataSentInFirstPacket = TRUE; + //LL_INFOS() << "LLViewerAssetStorage::createAsset sending data in first packet" << LL_ENDL; + } + else + { + LL_WARNS() << "Probable corruption in VFS file, aborting store asset data" << LL_ENDL; + + // LLAssetStorage metric: VFS corrupt - bogus size + reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, asset_size, MR_VFS_CORRUPTION, __FILE__, __LINE__, "VFS corruption" ); + + if (callback) + { + callback(asset_id, user_data, LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE, LL_EXSTAT_VFS_CORRUPT); + } + return; + } + } + else + { + // Too big, do an xfer + buffer[0] = 0; + asset_size = 0; + } + mMessageSys->newMessageFast(_PREHASH_AssetUploadRequest); + mMessageSys->nextBlockFast(_PREHASH_AssetBlock); + mMessageSys->addUUIDFast(_PREHASH_TransactionID, tid); + mMessageSys->addS8Fast(_PREHASH_Type, (S8)asset_type); + mMessageSys->addBOOLFast(_PREHASH_Tempfile, temp_file); + mMessageSys->addBOOLFast(_PREHASH_StoreLocal, store_local); + mMessageSys->addBinaryDataFast( _PREHASH_AssetData, buffer, asset_size ); + mMessageSys->sendReliable(mUpstreamHost); + } + else + { + LL_WARNS() << "AssetStorage: attempt to upload non-existent vfile " << asset_id << ":" << LLAssetType::lookup(asset_type) << LL_ENDL; + // LLAssetStorage metric: Zero size VFS + 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); + } + } + } + else + { + LL_WARNS() << "Attempt to move asset store request upstream w/o valid upstream provider" << LL_ENDL; + // LLAssetStorage metric: Upstream provider dead + 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); + } + } } void LLViewerAssetStorage::storeAssetData( - const std::string& filename, - const LLTransactionID& tid, - LLAssetType::EType asset_type, - LLStoreAssetCallback callback, - void* user_data, - bool temp_file, - bool is_priority, - bool user_waiting, - F64Seconds timeout) + const std::string& filename, + const LLTransactionID& tid, + LLAssetType::EType asset_type, + LLStoreAssetCallback callback, + void* user_data, + bool temp_file, + bool is_priority, + bool user_waiting, + F64Seconds timeout) { - if(filename.empty()) - { - // LLAssetStorage metric: no filename - reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_VFS_CORRUPTION, __FILE__, __LINE__, "Filename missing" ); - LL_ERRS() << "No filename specified" << LL_ENDL; - return; - } - - LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << LL_ENDL; - - LL_DEBUGS("AssetStorage") << "ASSET_ID: " << asset_id << LL_ENDL; - - S32 size = 0; - LLFILE* fp = LLFile::fopen(filename, "rb"); - if (fp) - { - fseek(fp, 0, SEEK_END); - size = ftell(fp); - fseek(fp, 0, SEEK_SET); - } - if( size ) - { - LLLegacyAssetRequest *legacy = new LLLegacyAssetRequest; - - legacy->mUpCallback = callback; - legacy->mUserData = user_data; - - LLVFile file(mVFS, asset_id, asset_type, LLVFile::WRITE); - - file.setMaxSize(size); - - const S32 buf_size = 65536; - U8 copy_buf[buf_size]; - while ((size = (S32)fread(copy_buf, 1, buf_size, fp))) - { - file.write(copy_buf, size); - } - fclose(fp); - - // if this upload fails, the caller needs to setup a new tempfile for us - if (temp_file) - { - LLFile::remove(filename); - } - - // LLAssetStorage metric: Success not needed; handled in the overloaded method here: - - LLViewerAssetStorage::storeAssetData( - tid, - asset_type, - legacyStoreDataCallback, - (void**)legacy, - temp_file, - is_priority); - } - else // size == 0 (but previous block changes size) - { - if( fp ) - { - // LLAssetStorage metric: Zero size - reportMetric( asset_id, asset_type, filename, LLUUID::null, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file was zero length" ); - } - else - { - // LLAssetStorage metric: Missing File - reportMetric( asset_id, asset_type, filename, LLUUID::null, 0, MR_FILE_NONEXIST, __FILE__, __LINE__, "The file didn't exist" ); - } - if (callback) - { - callback(asset_id, user_data, LL_ERR_CANNOT_OPEN_FILE, LL_EXSTAT_BLOCKED_FILE); - } - } + if(filename.empty()) + { + // LLAssetStorage metric: no filename + reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_VFS_CORRUPTION, __FILE__, __LINE__, "Filename missing" ); + LL_ERRS() << "No filename specified" << LL_ENDL; + return; + } + + LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); + LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << LL_ENDL; + + LL_DEBUGS("AssetStorage") << "ASSET_ID: " << asset_id << LL_ENDL; + + S32 size = 0; + LLFILE* fp = LLFile::fopen(filename, "rb"); + if (fp) + { + fseek(fp, 0, SEEK_END); + size = ftell(fp); + fseek(fp, 0, SEEK_SET); + } + if( size ) + { + LLLegacyAssetRequest *legacy = new LLLegacyAssetRequest; + + legacy->mUpCallback = callback; + legacy->mUserData = user_data; + + LLVFile file(mVFS, asset_id, asset_type, LLVFile::WRITE); + + file.setMaxSize(size); + + const S32 buf_size = 65536; + U8 copy_buf[buf_size]; + while ((size = (S32)fread(copy_buf, 1, buf_size, fp))) + { + file.write(copy_buf, size); + } + fclose(fp); + + // if this upload fails, the caller needs to setup a new tempfile for us + if (temp_file) + { + LLFile::remove(filename); + } + + // LLAssetStorage metric: Success not needed; handled in the overloaded method here: + + LLViewerAssetStorage::storeAssetData( + tid, + asset_type, + legacyStoreDataCallback, + (void**)legacy, + temp_file, + is_priority); + } + else // size == 0 (but previous block changes size) + { + if( fp ) + { + // LLAssetStorage metric: Zero size + reportMetric( asset_id, asset_type, filename, LLUUID::null, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file was zero length" ); + } + else + { + // LLAssetStorage metric: Missing File + reportMetric( asset_id, asset_type, filename, LLUUID::null, 0, MR_FILE_NONEXIST, __FILE__, __LINE__, "The file didn't exist" ); + } + if (callback) + { + callback(asset_id, user_data, LL_ERR_CANNOT_OPEN_FILE, LL_EXSTAT_BLOCKED_FILE); + } + } } @@ -334,56 +337,56 @@ void LLViewerAssetStorage::storeAssetData( // virtual void LLViewerAssetStorage::_queueDataRequest( - const LLUUID& uuid, - LLAssetType::EType atype, - LLGetAssetCallback callback, - void *user_data, - BOOL duplicate, - BOOL is_priority) + 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 - LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype); - 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)); - - LLViewerAssetStatsFF::record_enqueue(atype, false, false); - } - } - 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); - } - } + if (mUpstreamHost.isOk()) + { + // stash the callback info so we can find it after we get the response message + LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype); + 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)); + + LLViewerAssetStatsFF::record_enqueue(atype, false, false); + } + } + 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); + } + } } -- cgit v1.2.3 From 7d375ed9b7070e354a8072d7ffa137e005691dcd Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 15 Feb 2017 15:34:56 -0500 Subject: SL-409 - WIP on http fetching path for assets --- indra/newview/llviewerassetstorage.cpp | 118 +++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index b5e68c0617..628eb9ec89 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -33,12 +33,16 @@ #include "message.h" #include "llagent.h" +#include "llviewerregion.h" // FIXME asset-http: We are the only customer for gTransferManager - the // whole class can be yanked once everything is http-ified. #include "lltransfersourceasset.h" #include "lltransfertargetvfile.h" #include "llviewerassetstats.h" +#include "llcoros.h" +#include "lleventcoro.h" +#include "llsdutil.h" ///---------------------------------------------------------------------------- /// LLViewerAssetRequest @@ -344,6 +348,26 @@ 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 @@ -390,3 +414,97 @@ void LLViewerAssetStorage::_queueDataRequest( } } +void LLViewerAssetStorage::queueRequestHttp( + const LLUUID& uuid, + LLAssetType::EType atype, + LLGetAssetCallback callback, + void *user_data, + BOOL duplicate, + BOOL is_priority) +{ + LL_DEBUGS("ViewerAsset") << "Request asset via HTTP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL; + std::string cap_url = gAgent.getRegion()->getCapability("ViewerAsset"); + if (cap_url.empty()) + { + LL_WARNS() << "No ViewerAsset cap found, fetch fails" << LL_ENDL; + // TODO: handle waiting for caps? Other failure mechanism? + return; + } + else + { + LL_DEBUGS("ViewerAsset") << "Will fetch via ViewerAsset cap " << cap_url << LL_ENDL; + + LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype); + 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); + + // TODO AssetStatsFF stuff from UDP too? + + // This is the same as the current UDP logic - don't re-request a duplicate. + if (!duplicate) + { + LLCoros::instance().launch("LLViewerAssetStorage::assetRequestCoro", + boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, uuid, atype, callback, user_data, duplicate, is_priority)); + } + } +} + +void LLViewerAssetStorage::assetRequestCoro( + const LLUUID& uuid, + LLAssetType::EType atype, + LLGetAssetCallback callback, + void *user_data, + BOOL duplicate, + BOOL is_priority) +{ + std::string url = getAssetURL(uuid,atype); + LL_DEBUGS("ViewerAsset") << "request url: " << url << LL_ENDL; + + // TODO: what about duplicates? + + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("assetRequestCoro", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); + + LLSD result = httpAdapter->getAndSuspend(httpRequest, url, httpOpts); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + if (!status) + { + // TODO: handle failures + LL_DEBUGS("ViewerAsset") << "request failed, status " << status.toTerseString() << ", now what?" << LL_ENDL; + } + else + { + LL_DEBUGS("ViewerAsset") << "request succeeded" << LL_ENDL; + + LL_DEBUGS("ViewerAsset") << "result: " << ll_pretty_print_sd(httpResults) << LL_ENDL; + + // TODO: Use asset data to create the asset + + // Clean up pending downloads and trigger callbacks + // TODO: what are result_code and ext_status? + S32 result_code = LL_ERR_NOERR; + LLExtStat ext_status = LL_EXSTAT_NONE; + removeAndCallbackPendingDownloads(result_code, uuid, atype, uuid, atype, ext_status); + } +} + +std::string LLViewerAssetStorage::getAssetURL(const LLUUID& uuid, LLAssetType::EType atype) +{ + std::string cap_url = gAgent.getRegion()->getCapability("ViewerAsset"); + std::string type_name = LLAssetType::lookup(atype); + std::string url = cap_url + "/?" + type_name + "_id=" + uuid.asString(); + return url; +} -- cgit v1.2.3 From 976b4f91ef3cfd36c0007d5b10d71c92b8bb3c44 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 17 Feb 2017 09:04:28 -0500 Subject: SL-409 - more WIP on http fetching path for assets, capture results to LLVFile. --- indra/newview/llviewerassetstorage.cpp | 49 +++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 16 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 628eb9ec89..3bb2b531dc 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -35,8 +35,6 @@ #include "llagent.h" #include "llviewerregion.h" -// FIXME asset-http: We are the only customer for gTransferManager - the -// whole class can be yanked once everything is http-ified. #include "lltransfersourceasset.h" #include "lltransfertargetvfile.h" #include "llviewerassetstats.h" @@ -427,7 +425,7 @@ void LLViewerAssetStorage::queueRequestHttp( if (cap_url.empty()) { LL_WARNS() << "No ViewerAsset cap found, fetch fails" << LL_ENDL; - // TODO: handle waiting for caps? Other failure mechanism? + // TODO asset-http: handle waiting for caps? Other failure mechanism? return; } else @@ -446,13 +444,13 @@ void LLViewerAssetStorage::queueRequestHttp( } mPendingDownloads.push_back(req); - // TODO AssetStatsFF stuff from UDP too? - // This is the same as the current UDP logic - don't re-request a duplicate. if (!duplicate) { + LLViewerAssetStatsFF::record_enqueue(atype, false, false); + LLCoros::instance().launch("LLViewerAssetStorage::assetRequestCoro", - boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, uuid, atype, callback, user_data, duplicate, is_priority)); + boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, uuid, atype, callback, user_data)); } } } @@ -461,28 +459,24 @@ void LLViewerAssetStorage::assetRequestCoro( const LLUUID& uuid, LLAssetType::EType atype, LLGetAssetCallback callback, - void *user_data, - BOOL duplicate, - BOOL is_priority) + void *user_data) { std::string url = getAssetURL(uuid,atype); LL_DEBUGS("ViewerAsset") << "request url: " << url << LL_ENDL; - // TODO: what about duplicates? - LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("assetRequestCoro", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); - LLSD result = httpAdapter->getAndSuspend(httpRequest, url, httpOpts); + LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) { - // TODO: handle failures + // TODO asset-http: handle failures LL_DEBUGS("ViewerAsset") << "request failed, status " << status.toTerseString() << ", now what?" << LL_ENDL; } else @@ -491,13 +485,36 @@ void LLViewerAssetStorage::assetRequestCoro( LL_DEBUGS("ViewerAsset") << "result: " << ll_pretty_print_sd(httpResults) << LL_ENDL; - // TODO: Use asset data to create the asset + const LLSD::Binary &raw = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary(); + + S32 size = raw.size(); + if (size > 0) + { + // This create-then-rename flow is modeled on LLTransferTargetVFile, which is what's used in the UDP case. + LLUUID temp_id; + temp_id.generate(); + LLVFile vf(gAssetStorage->mVFS, temp_id, atype, LLVFile::WRITE); + vf.setMaxSize(size); + if (!vf.write(raw.data(),size)) + { + // TODO asset-http: handle error + LL_ERRS() << "Failure in vf.write()" << LL_ENDL; + } + if (!vf.rename(uuid, atype)) + { + LL_ERRS() << "rename failed" << LL_ENDL; + } + } + else + { + // TODO asset-http: handle invalid size case + } // Clean up pending downloads and trigger callbacks - // TODO: what are result_code and ext_status? + // TODO asset-http: what are the result_code and ext_status? S32 result_code = LL_ERR_NOERR; LLExtStat ext_status = LL_EXSTAT_NONE; - removeAndCallbackPendingDownloads(result_code, uuid, atype, uuid, atype, ext_status); + removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status); } } -- cgit v1.2.3 From 578e927641477bfbd032adbe7717fda45c0cc0ea Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 27 Feb 2017 14:52:08 -0500 Subject: SL-409 - viewer asset stats updates to distinguish http and udp fetches --- indra/newview/llviewerassetstorage.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 3bb2b531dc..347810e169 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -56,9 +56,10 @@ class LLViewerAssetRequest : public LLAssetRequest { public: - LLViewerAssetRequest(const LLUUID &uuid, const LLAssetType::EType type) + LLViewerAssetRequest(const LLUUID &uuid, const LLAssetType::EType type, bool with_http) : LLAssetRequest(uuid, type), - mMetricsStartTime(0) + mMetricsStartTime(0), + mWithHTTP(with_http) { } @@ -78,8 +79,8 @@ protected: { // Okay, it appears this request was used for useful things. Record // the expected dequeue and duration of request processing. - LLViewerAssetStatsFF::record_dequeue(mType, false, false); - LLViewerAssetStatsFF::record_response(mType, false, false, + LLViewerAssetStatsFF::record_dequeue(mType, mWithHTTP, false); + LLViewerAssetStatsFF::record_response(mType, mWithHTTP, false, (LLViewerAssetStatsFF::get_timestamp() - mMetricsStartTime)); mMetricsStartTime = (U32Seconds)0; @@ -88,6 +89,7 @@ protected: public: LLViewerAssetStats::duration_t mMetricsStartTime; + bool mWithHTTP; }; ///---------------------------------------------------------------------------- @@ -369,7 +371,8 @@ void LLViewerAssetStorage::queueRequestUDP( if (mUpstreamHost.isOk()) { // stash the callback info so we can find it after we get the response message - LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype); + bool with_http = false; + LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype, with_http); req->mDownCallback = callback; req->mUserData = user_data; req->mIsPriority = is_priority; @@ -398,7 +401,9 @@ void LLViewerAssetStorage::queueRequestUDP( LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(mUpstreamHost, LLTCT_ASSET); ttcp->requestTransfer(spa, tpvf, 100.f + (is_priority ? 1.f : 0.f)); - LLViewerAssetStatsFF::record_enqueue(atype, false, false); + bool with_http = false; + bool is_temp = false; + LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); } } else @@ -432,7 +437,8 @@ void LLViewerAssetStorage::queueRequestHttp( { LL_DEBUGS("ViewerAsset") << "Will fetch via ViewerAsset cap " << cap_url << LL_ENDL; - LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype); + bool with_http = true; + LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype, with_http); req->mDownCallback = callback; req->mUserData = user_data; req->mIsPriority = is_priority; @@ -447,7 +453,9 @@ void LLViewerAssetStorage::queueRequestHttp( // This is the same as the current UDP logic - don't re-request a duplicate. if (!duplicate) { - LLViewerAssetStatsFF::record_enqueue(atype, false, false); + 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, uuid, atype, callback, user_data)); @@ -481,9 +489,9 @@ void LLViewerAssetStorage::assetRequestCoro( } else { - LL_DEBUGS("ViewerAsset") << "request succeeded" << LL_ENDL; + LL_DEBUGS("ViewerAsset") << "request succeeded, url " << url << LL_ENDL; - LL_DEBUGS("ViewerAsset") << "result: " << ll_pretty_print_sd(httpResults) << LL_ENDL; + // LL_DEBUGS("ViewerAsset") << "result: " << ll_pretty_print_sd(httpResults) << LL_ENDL; const LLSD::Binary &raw = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary(); @@ -508,6 +516,7 @@ void LLViewerAssetStorage::assetRequestCoro( else { // TODO asset-http: handle invalid size case + LL_ERRS() << "bad size" << LL_ENDL; } // Clean up pending downloads and trigger callbacks -- cgit v1.2.3 From df7c58b6ebba35541224233c1ec0138001682374 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 2 Mar 2017 13:51:28 -0500 Subject: SL-409 - code simplification for asset metrics, added a couple of new categories, error handling --- indra/newview/llviewerassetstorage.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 347810e169..85150bf7fa 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -471,7 +471,7 @@ void LLViewerAssetStorage::assetRequestCoro( { std::string url = getAssetURL(uuid,atype); LL_DEBUGS("ViewerAsset") << "request url: " << url << LL_ENDL; - + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("assetRequestCoro", httpPolicy)); @@ -480,19 +480,22 @@ 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) { // TODO asset-http: handle failures LL_DEBUGS("ViewerAsset") << "request failed, status " << status.toTerseString() << ", now what?" << LL_ENDL; + result_code = LL_ERR_ASSET_REQUEST_FAILED; + ext_status = LL_EXSTAT_NONE; } else { LL_DEBUGS("ViewerAsset") << "request succeeded, url " << url << LL_ENDL; - // LL_DEBUGS("ViewerAsset") << "result: " << ll_pretty_print_sd(httpResults) << LL_ENDL; - const LLSD::Binary &raw = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary(); S32 size = raw.size(); @@ -506,25 +509,28 @@ void LLViewerAssetStorage::assetRequestCoro( if (!vf.write(raw.data(),size)) { // TODO asset-http: handle error - LL_ERRS() << "Failure in vf.write()" << LL_ENDL; + LL_WARNS() << "Failure in vf.write()" << LL_ENDL; + result_code = LL_ERR_ASSET_REQUEST_FAILED; + ext_status = LL_EXSTAT_VFS_CORRUPT; } if (!vf.rename(uuid, atype)) { - LL_ERRS() << "rename failed" << LL_ENDL; + LL_WARNS() << "rename failed" << LL_ENDL; + result_code = LL_ERR_ASSET_REQUEST_FAILED; + ext_status = LL_EXSTAT_VFS_CORRUPT; } } else { // TODO asset-http: handle invalid size case - LL_ERRS() << "bad size" << LL_ENDL; + LL_WARNS() << "bad size" << LL_ENDL; + result_code = LL_ERR_ASSET_REQUEST_FAILED; + ext_status = LL_EXSTAT_NONE; } - - // Clean up pending downloads and trigger callbacks - // TODO asset-http: what are the result_code and ext_status? - S32 result_code = LL_ERR_NOERR; - LLExtStat ext_status = LL_EXSTAT_NONE; - removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status); } + + // Clean up pending downloads and trigger callbacks + removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status); } std::string LLViewerAssetStorage::getAssetURL(const LLUUID& uuid, LLAssetType::EType atype) -- cgit v1.2.3 From f70abb4ad628b19c993a22c7e86d350395555fcf Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 3 Mar 2017 15:14:09 -0500 Subject: SL-409 - added tracking for bytes fetched to viewer assets metrics (does not currently work for textures) --- indra/newview/llviewerassetstorage.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 85150bf7fa..fa3567620c 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -82,7 +82,8 @@ protected: LLViewerAssetStatsFF::record_dequeue(mType, mWithHTTP, false); LLViewerAssetStatsFF::record_response(mType, mWithHTTP, false, (LLViewerAssetStatsFF::get_timestamp() - - mMetricsStartTime)); + - mMetricsStartTime), + mBytesFetched); mMetricsStartTime = (U32Seconds)0; } } @@ -458,12 +459,13 @@ void LLViewerAssetStorage::queueRequestHttp( LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); LLCoros::instance().launch("LLViewerAssetStorage::assetRequestCoro", - boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, uuid, atype, callback, user_data)); + boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data)); } } } void LLViewerAssetStorage::assetRequestCoro( + LLViewerAssetRequest *req, const LLUUID& uuid, LLAssetType::EType atype, LLGetAssetCallback callback, @@ -506,6 +508,7 @@ void LLViewerAssetStorage::assetRequestCoro( temp_id.generate(); LLVFile vf(gAssetStorage->mVFS, temp_id, atype, LLVFile::WRITE); vf.setMaxSize(size); + req->mBytesFetched = size; if (!vf.write(raw.data(),size)) { // TODO asset-http: handle error -- cgit v1.2.3 From 09a6daabd2c4281b071f9213906872ea8a744956 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 6 Mar 2017 14:31:31 -0500 Subject: SL-409 - consolidated user of ViewerAsset cap for mesh and texture fetching as well. --- indra/newview/llviewerassetstorage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index fa3567620c..41f407b8d9 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -538,7 +538,7 @@ void LLViewerAssetStorage::assetRequestCoro( std::string LLViewerAssetStorage::getAssetURL(const LLUUID& uuid, LLAssetType::EType atype) { - std::string cap_url = gAgent.getRegion()->getCapability("ViewerAsset"); + 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; -- cgit v1.2.3 From 1f44919b3fc994adc27d16fc9dbd476c08d24e3a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 6 Mar 2017 17:07:44 -0500 Subject: SL-409 - use AP_TEXTURE policy for other viewer asset fetches. Enables pipelining. --- indra/newview/llviewerassetstorage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 41f407b8d9..153108d8a9 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -33,6 +33,7 @@ #include "message.h" #include "llagent.h" +#include "llappcorehttp.h" #include "llviewerregion.h" #include "lltransfersourceasset.h" @@ -474,7 +475,7 @@ void LLViewerAssetStorage::assetRequestCoro( std::string url = getAssetURL(uuid,atype); LL_DEBUGS("ViewerAsset") << "request url: " << url << LL_ENDL; - LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCore::HttpRequest::policy_t httpPolicy(LLAppCoreHttp::AP_TEXTURE); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("assetRequestCoro", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); -- cgit v1.2.3 From 295c8a437afb29be1ec4b59acad60c35afb6ffc3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 20 Mar 2017 08:12:37 -0400 Subject: MAINT-7195 possible fix --- indra/newview/llviewerassetstorage.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 153108d8a9..496fbbecff 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -428,6 +428,11 @@ 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()) { -- cgit v1.2.3 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/llviewerassetstorage.cpp | 162 ++++++++++++--------------------- 1 file changed, 60 insertions(+), 102 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') 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; -- cgit v1.2.3 From 9311cc89ea36139b454b36349f11162f72924df7 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 11 Apr 2017 13:45:43 -0400 Subject: DRTVWR-434 - trivial code change to trigger TC rebuild, also slight improvement to a log message --- indra/newview/llviewerassetstorage.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index cb60337a7f..d95b104f5c 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -455,7 +455,7 @@ void LLViewerAssetStorage::assetRequestCoro( if (!status) { // TODO asset-http: handle failures - LL_DEBUGS("ViewerAsset") << "request failed, status " << status.toTerseString() << ", now what?" << LL_ENDL; + LL_DEBUGS("ViewerAsset") << "request failed, status " << status.toTerseString() << LL_ENDL; result_code = LL_ERR_ASSET_REQUEST_FAILED; ext_status = LL_EXSTAT_NONE; } @@ -468,7 +468,9 @@ void LLViewerAssetStorage::assetRequestCoro( S32 size = raw.size(); if (size > 0) { - // This create-then-rename flow is modeled on LLTransferTargetVFile, which is what's used in the UDP case. + // This create-then-rename flow is modeled on + // LLTransferTargetVFile, which is what was used in the UDP + // case. LLUUID temp_id; temp_id.generate(); LLVFile vf(gAssetStorage->mVFS, temp_id, atype, LLVFile::WRITE); -- cgit v1.2.3 From 3bb00a99e3277828d3c126574e4c676712bcf758 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 12 Apr 2017 16:06:23 -0400 Subject: MAINT-7195 - fixed bug in the wait-for-caps logic. Doesn't really matter in practice since the member variable in question still gets set by the cap received callback. --- indra/newview/llviewerassetstorage.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index d95b104f5c..0ca896ce1a 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -424,12 +424,9 @@ void LLViewerAssetStorage::assetRequestCoro( llcoro::suspendUntilEventOn(capsRecv); } - else + if (mViewerAssetUrl.empty()) { - if (mViewerAssetUrl.empty()) - { - mViewerAssetUrl = gAgent.getRegion()->getViewerAssetUrl(); - } + mViewerAssetUrl = gAgent.getRegion()->getViewerAssetUrl(); } if (mViewerAssetUrl.empty()) { @@ -454,7 +451,6 @@ void LLViewerAssetStorage::assetRequestCoro( LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) { - // TODO asset-http: handle failures LL_DEBUGS("ViewerAsset") << "request failed, status " << status.toTerseString() << LL_ENDL; result_code = LL_ERR_ASSET_REQUEST_FAILED; ext_status = LL_EXSTAT_NONE; -- cgit v1.2.3 From 1ea0db76f60e4d90a846390f9480ae2ae2534fbb Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 18 Apr 2017 17:33:50 -0400 Subject: SL-409 - Added a bit more logging in hopes of locating cause of increased crashes. --- indra/newview/llviewerassetstorage.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 0ca896ce1a..c0fd0774f6 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -392,7 +392,14 @@ void LLViewerAssetStorage::queueRequestHttp( void LLViewerAssetStorage::capsRecvForRegion(const LLUUID& region_id, std::string pumpname) { LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(region_id); - mViewerAssetUrl = regionp->getViewerAssetUrl(); + if (!regionp) + { + LL_WARNS() << "region not found for region_id " << region_id << LL_ENDL; + } + else + { + mViewerAssetUrl = regionp->getViewerAssetUrl(); + } LLEventPumps::instance().obtain(pumpname).post(LLSD()); } @@ -417,14 +424,18 @@ void LLViewerAssetStorage::assetRequestCoro( } else if (!gAgent.getRegion()->capabilitiesReceived()) { + LL_WARNS_ONCE() << "Waiting for capabilities" << LL_ENDL; + LLEventStream capsRecv("waitForCaps", true); gAgent.getRegion()->setCapabilitiesReceivedCallback( boost::bind(&LLViewerAssetStorage::capsRecvForRegion, this, _1, capsRecv.getName())); llcoro::suspendUntilEventOn(capsRecv); + LL_WARNS_ONCE() << "capsRecv got event" << LL_ENDL; + LL_WARNS_ONCE() << "region " << gAgent.getRegion() << " mViewerAssetUrl " << mViewerAssetUrl << LL_ENDL; } - if (mViewerAssetUrl.empty()) + if (mViewerAssetUrl.empty() && gAgent.getRegion()) { mViewerAssetUrl = gAgent.getRegion()->getViewerAssetUrl(); } -- cgit v1.2.3 From 8d12ef71a0de00f7bb3ecce61b7fe3a84bda1b88 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 19 Apr 2017 16:01:56 -0400 Subject: SL-409 - Added tags to some log messages --- indra/newview/llviewerassetstorage.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index c0fd0774f6..bb9195fe90 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -147,7 +147,7 @@ void LLViewerAssetStorage::storeAssetData( if (asset_size < 1) { // This can happen if there's a bug in our code or if the VFS has been corrupted. - LL_WARNS() << "LLViewerAssetStorage::storeAssetData() Data _should_ already be in the VFS, but it's not! " << asset_id << LL_ENDL; + LL_WARNS("AssetStorage") << "LLViewerAssetStorage::storeAssetData() Data _should_ already be in the VFS, but it's not! " << asset_id << LL_ENDL; // LLAssetStorage metric: Zero size VFS 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)" ); @@ -188,7 +188,7 @@ void LLViewerAssetStorage::storeAssetData( } else { - LL_WARNS() << "Probable corruption in VFS file, aborting store asset data" << LL_ENDL; + LL_WARNS("AssetStorage") << "Probable corruption in VFS file, aborting store asset data" << LL_ENDL; // LLAssetStorage metric: VFS corrupt - bogus size reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, asset_size, MR_VFS_CORRUPTION, __FILE__, __LINE__, "VFS corruption" ); @@ -217,7 +217,7 @@ void LLViewerAssetStorage::storeAssetData( } else { - LL_WARNS() << "AssetStorage: attempt to upload non-existent vfile " << asset_id << ":" << LLAssetType::lookup(asset_type) << LL_ENDL; + LL_WARNS("AssetStorage") << "AssetStorage: attempt to upload non-existent vfile " << asset_id << ":" << LLAssetType::lookup(asset_type) << LL_ENDL; // LLAssetStorage metric: Zero size VFS 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) @@ -228,7 +228,7 @@ void LLViewerAssetStorage::storeAssetData( } else { - LL_WARNS() << "Attempt to move asset store request upstream w/o valid upstream provider" << LL_ENDL; + LL_WARNS("AssetStorage") << "Attempt to move asset store request upstream w/o valid upstream provider" << LL_ENDL; // LLAssetStorage metric: Upstream provider dead reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_NO_UPSTREAM, __FILE__, __LINE__, "No upstream provider" ); if (callback) @@ -394,7 +394,7 @@ void LLViewerAssetStorage::capsRecvForRegion(const LLUUID& region_id, std::strin LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(region_id); if (!regionp) { - LL_WARNS() << "region not found for region_id " << region_id << LL_ENDL; + LL_WARNS("ViewerAsset") << "region not found for region_id " << region_id << LL_ENDL; } else { @@ -416,7 +416,7 @@ void LLViewerAssetStorage::assetRequestCoro( if (!gAgent.getRegion()) { - LL_WARNS_ONCE() << "Asset request fails: no region set" << LL_ENDL; + LL_WARNS_ONCE("ViewerAsset") << "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); @@ -424,7 +424,7 @@ void LLViewerAssetStorage::assetRequestCoro( } else if (!gAgent.getRegion()->capabilitiesReceived()) { - LL_WARNS_ONCE() << "Waiting for capabilities" << LL_ENDL; + LL_WARNS_ONCE("ViewerAsset") << "Waiting for capabilities" << LL_ENDL; LLEventStream capsRecv("waitForCaps", true); @@ -432,8 +432,8 @@ void LLViewerAssetStorage::assetRequestCoro( boost::bind(&LLViewerAssetStorage::capsRecvForRegion, this, _1, capsRecv.getName())); llcoro::suspendUntilEventOn(capsRecv); - LL_WARNS_ONCE() << "capsRecv got event" << LL_ENDL; - LL_WARNS_ONCE() << "region " << gAgent.getRegion() << " mViewerAssetUrl " << mViewerAssetUrl << LL_ENDL; + LL_WARNS_ONCE("ViewerAsset") << "capsRecv got event" << LL_ENDL; + LL_WARNS_ONCE("ViewerAsset") << "region " << gAgent.getRegion() << " mViewerAssetUrl " << mViewerAssetUrl << LL_ENDL; } if (mViewerAssetUrl.empty() && gAgent.getRegion()) { @@ -441,7 +441,7 @@ void LLViewerAssetStorage::assetRequestCoro( } if (mViewerAssetUrl.empty()) { - LL_WARNS_ONCE() << "asset request fails: caps received but no viewer asset cap found" << LL_ENDL; + 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; removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status); @@ -486,13 +486,13 @@ void LLViewerAssetStorage::assetRequestCoro( if (!vf.write(raw.data(),size)) { // TODO asset-http: handle error - LL_WARNS() << "Failure in vf.write()" << LL_ENDL; + LL_WARNS("ViewerAsset") << "Failure in vf.write()" << LL_ENDL; result_code = LL_ERR_ASSET_REQUEST_FAILED; ext_status = LL_EXSTAT_VFS_CORRUPT; } if (!vf.rename(uuid, atype)) { - LL_WARNS() << "rename failed" << LL_ENDL; + LL_WARNS("ViewerAsset") << "rename failed" << LL_ENDL; result_code = LL_ERR_ASSET_REQUEST_FAILED; ext_status = LL_EXSTAT_VFS_CORRUPT; } @@ -500,7 +500,7 @@ void LLViewerAssetStorage::assetRequestCoro( else { // TODO asset-http: handle invalid size case - LL_WARNS() << "bad size" << LL_ENDL; + LL_WARNS("ViewerAsset") << "bad size" << LL_ENDL; result_code = LL_ERR_ASSET_REQUEST_FAILED; ext_status = LL_EXSTAT_NONE; } -- cgit v1.2.3 From e6f53dedb704c92af45ede2d97c559cb6639358f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 24 Apr 2017 11:25:04 -0400 Subject: MAINT-7343 - Added check for shutdown in progress when asset result arrives --- indra/newview/llviewerassetstorage.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index bb9195fe90..6523b89d7f 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -458,6 +458,12 @@ void LLViewerAssetStorage::assetRequestCoro( LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts); + if (LLApp::isQuitting()) + { + // Bail out if result arrives after shutdown has been started. + return; + } + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) -- cgit v1.2.3 From b7b8d6e1aedeac1dfdfcc9200024bbcc8e2dacae Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Apr 2017 12:39:14 -0400 Subject: MAINT-7343 - added periodic logging of state of the asset store. --- indra/newview/llviewerassetstorage.cpp | 51 ++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 6523b89d7f..9918d226c2 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -99,17 +99,30 @@ public: /// LLViewerAssetStorage ///---------------------------------------------------------------------------- +// Unused? LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, LLVFS *static_vfs, const LLHost &upstream_host) - : LLAssetStorage(msg, xfer, vfs, static_vfs, upstream_host) + : LLAssetStorage(msg, xfer, vfs, static_vfs, upstream_host), + mAssetCoroCount(0), + mCountRequests(0), + mCountStarted(0), + mCountCompleted(0), + mCountSucceeded(0), + mTotalBytesFetched(0) { } LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, LLVFS *static_vfs) - : LLAssetStorage(msg, xfer, vfs, static_vfs) + : LLAssetStorage(msg, xfer, vfs, static_vfs), + mAssetCoroCount(0), + mCountRequests(0), + mCountStarted(0), + mCountCompleted(0), + mCountSucceeded(0), + mTotalBytesFetched(0) { } @@ -351,6 +364,7 @@ void LLViewerAssetStorage::_queueDataRequest( BOOL duplicate, BOOL is_priority) { + mCountRequests++; queueRequestHttp(uuid, atype, callback, user_data, duplicate, is_priority); } @@ -404,6 +418,20 @@ void LLViewerAssetStorage::capsRecvForRegion(const LLUUID& region_id, std::strin LLEventPumps::instance().obtain(pumpname).post(LLSD()); } +struct LLScopedIncrement +{ + LLScopedIncrement(S32& counter): + mCounter(counter) + { + ++mCounter; + } + ~LLScopedIncrement() + { + --mCounter; + } + S32& mCounter; +}; + void LLViewerAssetStorage::assetRequestCoro( LLViewerAssetRequest *req, const LLUUID& uuid, @@ -411,6 +439,9 @@ void LLViewerAssetStorage::assetRequestCoro( LLGetAssetCallback callback, void *user_data) { + LLScopedIncrement coro_count_boost(mAssetCoroCount); + mCountStarted++; + S32 result_code = LL_ERR_NOERR; LLExtStat ext_status = LL_EXSTAT_NONE; @@ -463,6 +494,8 @@ void LLViewerAssetStorage::assetRequestCoro( // Bail out if result arrives after shutdown has been started. return; } + + mCountCompleted++; LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -481,6 +514,8 @@ void LLViewerAssetStorage::assetRequestCoro( S32 size = raw.size(); if (size > 0) { + mTotalBytesFetched += size; + // This create-then-rename flow is modeled on // LLTransferTargetVFile, which is what was used in the UDP // case. @@ -502,6 +537,7 @@ void LLViewerAssetStorage::assetRequestCoro( result_code = LL_ERR_ASSET_REQUEST_FAILED; ext_status = LL_EXSTAT_VFS_CORRUPT; } + mCountSucceeded++; } else { @@ -522,3 +558,14 @@ std::string LLViewerAssetStorage::getAssetURL(const std::string& cap_url, const std::string url = cap_url + "/?" + type_name + "_id=" + uuid.asString(); return url; } + +void LLViewerAssetStorage::logAssetStorageInfo() +{ + LLMemory::logMemoryInfo(true); + LL_INFOS("AssetStorage") << "Active coros " << mAssetCoroCount << LL_ENDL; + LL_INFOS("AssetStorage") << "mPendingDownloads size " << mPendingDownloads.size() << LL_ENDL; + LL_INFOS("AssetStorage") << "mCountStarted " << mCountStarted << LL_ENDL; + LL_INFOS("AssetStorage") << "mCountCompleted " << mCountCompleted << LL_ENDL; + LL_INFOS("AssetStorage") << "mCountSucceeded " << mCountSucceeded << LL_ENDL; + LL_INFOS("AssetStorage") << "mTotalBytesFetched " << mTotalBytesFetched << LL_ENDL; +} -- cgit v1.2.3 From 9dfb5614e640b3350d89500b7d7486e2065ed7e2 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 28 Apr 2017 16:10:24 -0400 Subject: MAINT-7343 - moved asset downloads to use coprocedure pools, which should reduce the size of potential memory spikes --- indra/newview/llviewerassetstorage.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 9918d226c2..71507b5608 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -40,6 +40,7 @@ #include "lltransfertargetvfile.h" #include "llviewerassetstats.h" #include "llcoros.h" +#include "llcoproceduremanager.h" #include "lleventcoro.h" #include "llsdutil.h" #include "llworld.h" @@ -398,8 +399,8 @@ void LLViewerAssetStorage::queueRequestHttp( 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)); + LLCoprocedureManager::instance().enqueueCoprocedure("AssetStorage","LLViewerAssetStorage::assetRequestCoro", + boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, _1, req, uuid, atype, callback, user_data)); } } @@ -433,6 +434,7 @@ struct LLScopedIncrement }; void LLViewerAssetStorage::assetRequestCoro( + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &defaultHttpAdapter, // not used LLViewerAssetRequest *req, const LLUUID& uuid, LLAssetType::EType atype, -- cgit v1.2.3 From 218615320a84fdd2d691c57bc9f26d7742be7e31 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 1 May 2017 15:05:57 -0400 Subject: MAINT-7343 - removed unusued coprocedure parameter, changed one coro argument to pass by value --- indra/newview/llviewerassetstorage.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 71507b5608..b9bdc4c06f 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -400,7 +400,7 @@ void LLViewerAssetStorage::queueRequestHttp( LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); LLCoprocedureManager::instance().enqueueCoprocedure("AssetStorage","LLViewerAssetStorage::assetRequestCoro", - boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, _1, req, uuid, atype, callback, user_data)); + boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data)); } } @@ -434,9 +434,8 @@ struct LLScopedIncrement }; void LLViewerAssetStorage::assetRequestCoro( - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &defaultHttpAdapter, // not used LLViewerAssetRequest *req, - const LLUUID& uuid, + const LLUUID uuid, LLAssetType::EType atype, LLGetAssetCallback callback, void *user_data) -- cgit v1.2.3 From 8528a9ae131dff09865eccd672efce621571c5e5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 9 May 2017 10:58:43 -0400 Subject: MAINT-7343 - improved error case handling and checking for unlikely corners --- indra/newview/llviewerassetstorage.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerassetstorage.cpp') diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index b9bdc4c06f..e0b64403ef 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -532,13 +532,16 @@ void LLViewerAssetStorage::assetRequestCoro( result_code = LL_ERR_ASSET_REQUEST_FAILED; ext_status = LL_EXSTAT_VFS_CORRUPT; } - if (!vf.rename(uuid, atype)) + 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; } - mCountSucceeded++; + else + { + mCountSucceeded++; + } } else { -- cgit v1.2.3