diff options
Diffstat (limited to 'linden/indra/llmessage/llhttpassetstorage.cpp')
-rw-r--r-- | linden/indra/llmessage/llhttpassetstorage.cpp | 68 |
1 files changed, 57 insertions, 11 deletions
diff --git a/linden/indra/llmessage/llhttpassetstorage.cpp b/linden/indra/llmessage/llhttpassetstorage.cpp index 5a0cdad..d83349b 100644 --- a/linden/indra/llmessage/llhttpassetstorage.cpp +++ b/linden/indra/llmessage/llhttpassetstorage.cpp | |||
@@ -428,14 +428,18 @@ void LLHTTPAssetStorage::storeAssetData( | |||
428 | bool temp_file, | 428 | bool temp_file, |
429 | bool is_priority, | 429 | bool is_priority, |
430 | bool store_local, | 430 | bool store_local, |
431 | const LLUUID& requesting_agent_id) | 431 | const LLUUID& requesting_agent_id, |
432 | bool user_waiting, | ||
433 | F64 timeout) | ||
432 | { | 434 | { |
433 | if (mVFS->getExists(uuid, type)) | 435 | if (mVFS->getExists(uuid, type)) |
434 | { | 436 | { |
435 | LLAssetRequest *req = new LLAssetRequest(uuid, type); | 437 | LLAssetRequest *req = new LLAssetRequest(uuid, type); |
436 | req->mUpCallback = callback; | 438 | req->mUpCallback = callback; |
437 | req->mUserData = user_data; | 439 | req->mUserData = user_data; |
438 | req->mRequestingAgentID = requesting_agent_id; | 440 | req->mRequestingAgentID = requesting_agent_id; |
441 | req->mIsUserWaiting = user_waiting; | ||
442 | req->mTimeout = timeout; | ||
439 | 443 | ||
440 | // this will get picked up and transmitted in checkForTimeouts | 444 | // this will get picked up and transmitted in checkForTimeouts |
441 | if(store_local) | 445 | if(store_local) |
@@ -469,7 +473,9 @@ void LLHTTPAssetStorage::storeAssetData( | |||
469 | LLStoreAssetCallback callback, | 473 | LLStoreAssetCallback callback, |
470 | void* user_data, | 474 | void* user_data, |
471 | bool temp_file, | 475 | bool temp_file, |
472 | bool is_priority) | 476 | bool is_priority, |
477 | bool user_waiting, | ||
478 | F64 timeout) | ||
473 | { | 479 | { |
474 | llinfos << "LLAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl; | 480 | llinfos << "LLAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl; |
475 | 481 | ||
@@ -509,7 +515,11 @@ void LLHTTPAssetStorage::storeAssetData( | |||
509 | legacyStoreDataCallback, | 515 | legacyStoreDataCallback, |
510 | (void**)legacy, | 516 | (void**)legacy, |
511 | temp_file, | 517 | temp_file, |
512 | is_priority); | 518 | is_priority, |
519 | false, | ||
520 | LLUUID::null, | ||
521 | user_waiting, | ||
522 | timeout); | ||
513 | } | 523 | } |
514 | else | 524 | else |
515 | { | 525 | { |
@@ -608,7 +618,19 @@ bool LLHTTPAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt, | |||
608 | // This request was found in the pending list. Move it to the end! | 618 | // This request was found in the pending list. Move it to the end! |
609 | LLAssetRequest* pending_req = *result; | 619 | LLAssetRequest* pending_req = *result; |
610 | pending->remove(pending_req); | 620 | pending->remove(pending_req); |
611 | pending->push_back(pending_req); | 621 | |
622 | if (!pending_req->mIsUserWaiting) //A user is waiting on this request. Toss it. | ||
623 | { | ||
624 | pending->push_back(pending_req); | ||
625 | } | ||
626 | else | ||
627 | { | ||
628 | if (pending_req->mUpCallback) //Clean up here rather than _callUploadCallbacks because this request is already cleared the req. | ||
629 | { | ||
630 | pending_req->mUpCallback(pending_req->getUUID(), pending_req->mUserData, -1); | ||
631 | } | ||
632 | |||
633 | } | ||
612 | 634 | ||
613 | llinfos << "Asset " << getRequestName(rt) << " request for " | 635 | llinfos << "Asset " << getRequestName(rt) << " request for " |
614 | << asset_id << "." << LLAssetType::lookup(asset_type) | 636 | << asset_id << "." << LLAssetType::lookup(asset_type) |
@@ -744,6 +766,14 @@ void LLHTTPAssetStorage::checkForTimeouts() | |||
744 | 766 | ||
745 | LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), | 767 | LLHTTPAssetRequest *new_req = new LLHTTPAssetRequest(this, req->getUUID(), |
746 | req->getType(), RT_UPLOAD, tmp_url, mCurlMultiHandle); | 768 | req->getType(), RT_UPLOAD, tmp_url, mCurlMultiHandle); |
769 | |||
770 | if (req->mIsUserWaiting) //If a user is waiting on a realtime response, we want to perserve information across upload attempts. | ||
771 | { | ||
772 | new_req->mTime = req->mTime; | ||
773 | new_req->mTimeout = req->mTimeout; | ||
774 | new_req->mIsUserWaiting = req->mIsUserWaiting; | ||
775 | } | ||
776 | |||
747 | if (do_compress) | 777 | if (do_compress) |
748 | { | 778 | { |
749 | new_req->prepareCompressedUpload(); | 779 | new_req->prepareCompressedUpload(); |
@@ -839,11 +869,12 @@ void LLHTTPAssetStorage::checkForTimeouts() | |||
839 | if (curl_msg && curl_msg->msg == CURLMSG_DONE) | 869 | if (curl_msg && curl_msg->msg == CURLMSG_DONE) |
840 | { | 870 | { |
841 | long curl_result = 0; | 871 | long curl_result = 0; |
842 | S32 xfer_result = 0; | 872 | S32 xfer_result = LL_ERR_NOERR; |
843 | 873 | ||
844 | LLHTTPAssetRequest *req = NULL; | 874 | LLHTTPAssetRequest *req = NULL; |
845 | curl_easy_getinfo(curl_msg->easy_handle, CURLINFO_PRIVATE, &req); | 875 | curl_easy_getinfo(curl_msg->easy_handle, CURLINFO_PRIVATE, &req); |
846 | 876 | ||
877 | // TODO: Throw curl_result at all callbacks. | ||
847 | curl_easy_getinfo(curl_msg->easy_handle, CURLINFO_HTTP_CODE, &curl_result); | 878 | curl_easy_getinfo(curl_msg->easy_handle, CURLINFO_HTTP_CODE, &curl_result); |
848 | if (RT_UPLOAD == req->mRequestType || RT_LOCALUPLOAD == req->mRequestType) | 879 | if (RT_UPLOAD == req->mRequestType || RT_LOCALUPLOAD == req->mRequestType) |
849 | { | 880 | { |
@@ -865,6 +896,12 @@ void LLHTTPAssetStorage::checkForTimeouts() | |||
865 | { | 896 | { |
866 | llwarns << "Re-requesting upload for " << req->getUUID() << ". Received upload error to " << req->mURLBuffer << | 897 | llwarns << "Re-requesting upload for " << req->getUUID() << ". Received upload error to " << req->mURLBuffer << |
867 | " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl; | 898 | " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl; |
899 | |||
900 | ////HACK (probably) I am sick of this getting requeued and driving me mad. | ||
901 | //if (req->mIsUserWaiting) | ||
902 | //{ | ||
903 | // deletePendingRequest(RT_UPLOAD, req->getType(), req->getUUID()); | ||
904 | //} | ||
868 | } | 905 | } |
869 | else | 906 | else |
870 | { | 907 | { |
@@ -949,14 +986,23 @@ void LLHTTPAssetStorage::checkForTimeouts() | |||
949 | 986 | ||
950 | void LLHTTPAssetStorage::bumpTimedOutUploads() | 987 | void LLHTTPAssetStorage::bumpTimedOutUploads() |
951 | { | 988 | { |
989 | bool user_waiting=FALSE; | ||
990 | |||
991 | F64 mt_secs = LLMessageSystem::getMessageTimeSeconds(); | ||
992 | |||
993 | if (mPendingUploads.size()) | ||
994 | { | ||
995 | request_list_t::iterator it = mPendingUploads.begin(); | ||
996 | LLAssetRequest* req = *it; | ||
997 | user_waiting=req->mIsUserWaiting; | ||
998 | } | ||
999 | |||
952 | // No point bumping currently running uploads if there are no others in line. | 1000 | // No point bumping currently running uploads if there are no others in line. |
953 | if (!(mPendingUploads.size() > mRunningUploads.size())) | 1001 | if (!(mPendingUploads.size() > mRunningUploads.size()) && !user_waiting) |
954 | { | 1002 | { |
955 | return; | 1003 | return; |
956 | } | 1004 | } |
957 | 1005 | ||
958 | F64 mt_secs = LLMessageSystem::getMessageTimeSeconds(); | ||
959 | |||
960 | // deletePendingRequest will modify the mRunningUploads list so we don't want to iterate over it. | 1006 | // deletePendingRequest will modify the mRunningUploads list so we don't want to iterate over it. |
961 | request_list_t temp_running = mRunningUploads; | 1007 | request_list_t temp_running = mRunningUploads; |
962 | 1008 | ||
@@ -967,7 +1013,7 @@ void LLHTTPAssetStorage::bumpTimedOutUploads() | |||
967 | //request_list_t::iterator curiter = iter++; | 1013 | //request_list_t::iterator curiter = iter++; |
968 | LLAssetRequest* req = *it; | 1014 | LLAssetRequest* req = *it; |
969 | 1015 | ||
970 | if ( LL_ASSET_STORAGE_TIMEOUT < (mt_secs - req->mTime) ) | 1016 | if ( req->mTimeout < (mt_secs - req->mTime) ) |
971 | { | 1017 | { |
972 | llwarns << "Asset upload request timed out for " | 1018 | llwarns << "Asset upload request timed out for " |
973 | << req->getUUID() << "." | 1019 | << req->getUUID() << "." |