From 55c92418ef3114a58825af65f4fe531d0c4b0502 Mon Sep 17 00:00:00 2001 From: Josh Bell Date: Fri, 22 Jun 2007 18:23:39 +0000 Subject: svn merge -r 63401:63939 svn+ssh://svn.lindenlab.com/svn/linden/branches/derez-asset-loss-1 --> release NOTE: Skipped whitespace-only changes --- indra/llmessage/llassetstorage.cpp | 18 +++++++--- indra/llmessage/llassetstorage.h | 19 +++++++--- indra/llmessage/llhttpassetstorage.cpp | 65 ++++++++++++++++++++++++++++------ indra/llmessage/llhttpassetstorage.h | 8 +++-- 4 files changed, 90 insertions(+), 20 deletions(-) (limited to 'indra') diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index b05636a45c..2f489608e7 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -143,6 +143,8 @@ LLAssetRequest::LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType type mIsTemp( FALSE ), mIsLocal(FALSE), mIsPriority(FALSE), + mIsUserWaiting(FALSE), + mTimeout(LL_ASSET_STORAGE_TIMEOUT), mDataSentInFirstPacket(FALSE), mDataIsInVFS( FALSE ) { @@ -1250,7 +1252,9 @@ void LLAssetStorage::storeAssetData( void* user_data, bool temp_file, bool is_priority, - bool store_local) + bool store_local, + bool user_waiting, + F64 timeout) { llwarns << "storeAssetData: wrong version called" << llendl; } @@ -1265,7 +1269,9 @@ void LLAssetStorage::storeAssetData( bool temp_file , bool is_priority, bool store_local, - const LLUUID& requesting_agent_id) + const LLUUID& requesting_agent_id, + bool user_waiting, + F64 timeout) { llwarns << "storeAssetData: wrong version called" << llendl; } @@ -1279,7 +1285,9 @@ void LLAssetStorage::storeAssetData( LLStoreAssetCallback callback, void* user_data, bool temp_file, - bool is_priority) + bool is_priority, + bool user_waiting, + F64 timeout) { llwarns << "storeAssetData: wrong version called" << llendl; } @@ -1293,7 +1301,9 @@ void LLAssetStorage::storeAssetData( LLStoreAssetCallback callback, void* user_data, bool temp_file, - bool is_priority) + bool is_priority, + bool user_waiting, + F64 timeout) { llwarns << "storeAssetData: wrong version called" << llendl; } diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h index 9777b8f1e4..df448b010e 100644 --- a/indra/llmessage/llassetstorage.h +++ b/indra/llmessage/llassetstorage.h @@ -75,6 +75,7 @@ public: void setUUID(const LLUUID& id) { mUUID = id; } void setType(LLAssetType::EType type) { mType = type; } + void setTimeout (F64 timeout) { mTimeout = timeout; } protected: LLUUID mUUID; @@ -89,7 +90,9 @@ public: LLHost mHost; BOOL mIsTemp; BOOL mIsLocal; + BOOL mIsUserWaiting; // We don't want to try forever if a user is waiting for a result. F64 mTime; // Message system time + F64 mTimeout; // Amount of time before timing out. BOOL mIsPriority; BOOL mDataSentInFirstPacket; BOOL mDataIsInVFS; @@ -232,7 +235,9 @@ public: void* user_data, bool temp_file = false, bool is_priority = false, - bool store_local = false); + bool store_local = false, + bool user_waiting= false, + F64 timeout=LL_ASSET_STORAGE_TIMEOUT); /* * AssetID version @@ -246,7 +251,9 @@ public: bool temp_file = false, bool is_priority = false, bool store_local = false, - const LLUUID& requesting_agent_id = LLUUID::null); + const LLUUID& requesting_agent_id = LLUUID::null, + bool user_waiting= false, + F64 timeout=LL_ASSET_STORAGE_TIMEOUT); virtual void checkForTimeouts(); @@ -340,7 +347,9 @@ public: LLStoreAssetCallback callback, void* user_data, bool temp_file = false, - bool is_priority = false); + bool is_priority = false, + bool user_waiting = false, + F64 timeout = LL_ASSET_STORAGE_TIMEOUT); /* * TransactionID version @@ -352,7 +361,9 @@ public: LLStoreAssetCallback callback, void *user_data, bool temp_file = false, - bool is_priority = false); + bool is_priority = false, + bool user_waiting = false, + F64 timeout = LL_ASSET_STORAGE_TIMEOUT); static void legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType, void *user_data, S32 status); static void legacyStoreDataCallback(const LLUUID &uuid, void *user_data, S32 status); diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp index aa91ebcd49..37b15d7822 100644 --- a/indra/llmessage/llhttpassetstorage.cpp +++ b/indra/llmessage/llhttpassetstorage.cpp @@ -408,14 +408,18 @@ void LLHTTPAssetStorage::storeAssetData( bool temp_file, bool is_priority, bool store_local, - const LLUUID& requesting_agent_id) + const LLUUID& requesting_agent_id, + bool user_waiting, + F64 timeout) { if (mVFS->getExists(uuid, type)) { LLAssetRequest *req = new LLAssetRequest(uuid, type); - req->mUpCallback = callback; - req->mUserData = user_data; + req->mUpCallback = callback; + req->mUserData = user_data; req->mRequestingAgentID = requesting_agent_id; + req->mIsUserWaiting = user_waiting; + req->mTimeout = timeout; // this will get picked up and transmitted in checkForTimeouts if(store_local) @@ -449,7 +453,9 @@ void LLHTTPAssetStorage::storeAssetData( LLStoreAssetCallback callback, void* user_data, bool temp_file, - bool is_priority) + bool is_priority, + bool user_waiting, + F64 timeout) { llinfos << "LLAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl; @@ -489,7 +495,11 @@ void LLHTTPAssetStorage::storeAssetData( legacyStoreDataCallback, (void**)legacy, temp_file, - is_priority); + is_priority, + false, + LLUUID::null, + user_waiting, + timeout); } else { @@ -588,7 +598,19 @@ bool LLHTTPAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt, // This request was found in the pending list. Move it to the end! LLAssetRequest* pending_req = *result; pending->remove(pending_req); - pending->push_back(pending_req); + + if (!pending_req->mIsUserWaiting) //A user is waiting on this request. Toss it. + { + pending->push_back(pending_req); + } + else + { + if (pending_req->mUpCallback) //Clean up here rather than _callUploadCallbacks because this request is already cleared the req. + { + pending_req->mUpCallback(pending_req->getUUID(), pending_req->mUserData, -1); + } + + } llinfos << "Asset " << getRequestName(rt) << " request for " << asset_id << "." << LLAssetType::lookup(asset_type) @@ -724,6 +746,14 @@ void LLHTTPAssetStorage::checkForTimeouts() LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), req->getType(), RT_UPLOAD, tmp_url, mCurlMultiHandle); + + if (req->mIsUserWaiting) //If a user is waiting on a realtime response, we want to perserve information across upload attempts. + { + new_req->mTime = req->mTime; + new_req->mTimeout = req->mTimeout; + new_req->mIsUserWaiting = req->mIsUserWaiting; + } + if (do_compress) { new_req->prepareCompressedUpload(); @@ -846,6 +876,12 @@ void LLHTTPAssetStorage::checkForTimeouts() { llwarns << "Re-requesting upload for " << req->getUUID() << ". Received upload error to " << req->mURLBuffer << " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl; + + ////HACK (probably) I am sick of this getting requeued and driving me mad. + //if (req->mIsUserWaiting) + //{ + // deletePendingRequest(RT_UPLOAD, req->getType(), req->getUUID()); + //} } else { @@ -930,14 +966,23 @@ void LLHTTPAssetStorage::checkForTimeouts() void LLHTTPAssetStorage::bumpTimedOutUploads() { + bool user_waiting=FALSE; + + F64 mt_secs = LLMessageSystem::getMessageTimeSeconds(); + + if (mPendingUploads.size()) + { + request_list_t::iterator it = mPendingUploads.begin(); + LLAssetRequest* req = *it; + user_waiting=req->mIsUserWaiting; + } + // No point bumping currently running uploads if there are no others in line. - if (!(mPendingUploads.size() > mRunningUploads.size())) + if (!(mPendingUploads.size() > mRunningUploads.size()) && !user_waiting) { return; } - F64 mt_secs = LLMessageSystem::getMessageTimeSeconds(); - // deletePendingRequest will modify the mRunningUploads list so we don't want to iterate over it. request_list_t temp_running = mRunningUploads; @@ -948,7 +993,7 @@ void LLHTTPAssetStorage::bumpTimedOutUploads() //request_list_t::iterator curiter = iter++; LLAssetRequest* req = *it; - if ( LL_ASSET_STORAGE_TIMEOUT < (mt_secs - req->mTime) ) + if ( req->mTimeout < (mt_secs - req->mTime) ) { llwarns << "Asset upload request timed out for " << req->getUUID() << "." diff --git a/indra/llmessage/llhttpassetstorage.h b/indra/llmessage/llhttpassetstorage.h index a9cd88d629..d6f74d7744 100644 --- a/indra/llmessage/llhttpassetstorage.h +++ b/indra/llmessage/llhttpassetstorage.h @@ -46,7 +46,9 @@ public: bool temp_file = false, bool is_priority = false, bool store_local = false, - const LLUUID& requesting_agent_id = LLUUID::null); + const LLUUID& requesting_agent_id = LLUUID::null, + bool user_waiting=FALSE, + F64 timeout=LL_ASSET_STORAGE_TIMEOUT); virtual void storeAssetData( const char* filename, @@ -55,7 +57,9 @@ public: LLStoreAssetCallback callback, void* user_data, bool temp_file, - bool is_priority); + bool is_priority, + bool user_waiting=FALSE, + F64 timeout=LL_ASSET_STORAGE_TIMEOUT); virtual LLSD getPendingDetails(ERequestType rt, LLAssetType::EType asset_type, -- cgit v1.2.3