diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-06-15 18:38:30 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-06-15 18:38:30 -0400 |
commit | 6532d5db2dc450295d7ee4272600aaf79188ebc1 (patch) | |
tree | 4a23677c5910ad2a69709185abf176641754c141 /indra | |
parent | 8e532652ebe02d479271d7ec6f2b7c293e020afe (diff) |
SH-1166 WIP
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/app_settings/settings.xml | 11 | ||||
-rwxr-xr-x | indra/newview/llmeshrepository.cpp | 82 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/newview/skins/default/xui/en/notifications.xml | 2 |
3 files changed, 70 insertions, 25 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 036408807d..27a9737d69 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5600,6 +5600,17 @@ <key>Value</key> <real>0</real> </map> + <key>MeshUploadFakeErrors</key> + <map> + <key>Comment</key> + <string>Force upload errors (for testing)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <real>0</real> + </map> <key>MigrateCacheDirectory</key> <map> <key>Comment</key> diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 494f6f2e01..083038acba 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -94,7 +94,8 @@ std::string make_dump_name(std::string prefix, S32 num) return prefix + boost::lexical_cast<std::string>(num) + std::string(".xml"); } -void dumpLLSDToFile(const LLSD& content, std::string filename); +void dump_llsd_to_file(const LLSD& content, std::string filename); +LLSD llsd_from_file(std::string filename); std::string header_lod[] = { @@ -468,8 +469,18 @@ public: }; -void log_upload_error(S32 status, const LLSD& content,std::string stage) +void log_upload_error(S32 status, const LLSD& content, std::string stage, std::string model_name) { + // Add notification popup. + LLSD args; + std::string message = content["error"]["message"]; + std::string identifier = content["error"]["identifier"]; + args["MESSAGE"] = message; + args["IDENTIFIER"] = identifier; + args["LABEL"] = model_name; + gMeshRepo.uploadError(args); + + // Log details. llwarns << "stage: " << stage << " http status: " << status << llendl; if (content.has("error")) { @@ -534,28 +545,36 @@ public: class LLWholeModelFeeResponder: public LLCurl::Responder { LLMeshUploadThread* mThread; + LLSD mModelData; public: - LLWholeModelFeeResponder(LLMeshUploadThread* thread): - mThread(thread) + LLWholeModelFeeResponder(LLMeshUploadThread* thread, LLSD& model_data): + mThread(thread), + mModelData(model_data) { } virtual void completed(U32 status, const std::string& reason, const LLSD& content) { + LLSD cc = content; + if (gSavedSettings.getS32("MeshUploadFakeErrors")&1) + { + cc = llsd_from_file("fake_upload_error.xml"); + } + llinfos << "completed" << llendl; mThread->mPendingUploads--; - dumpLLSDToFile(content,make_dump_name("whole_model_fee_response_",dump_num)); + dump_llsd_to_file(cc,make_dump_name("whole_model_fee_response_",dump_num)); if (isGoodStatus(status) && - content["state"].asString() == "upload") + cc["state"].asString() == "upload") { llinfos << "fee request succeeded" << llendl; - mThread->mWholeModelUploadURL = content["uploader"].asString(); + mThread->mWholeModelUploadURL = cc["uploader"].asString(); } else { llwarns << "fee request failed" << llendl; - log_upload_error(status,content,"fee"); + log_upload_error(status,cc,"fee",mModelData["name"]); mThread->mWholeModelUploadURL = ""; } } @@ -565,35 +584,42 @@ public: class LLWholeModelUploadResponder: public LLCurl::Responder { LLMeshUploadThread* mThread; - LLSD mPostData; + LLSD mModelData; public: - LLWholeModelUploadResponder(LLMeshUploadThread* thread, LLSD& post_data): + LLWholeModelUploadResponder(LLMeshUploadThread* thread, LLSD& model_data): mThread(thread), - mPostData(post_data) + mModelData(model_data) { } virtual void completed(U32 status, const std::string& reason, const LLSD& content) { + LLSD cc = content; + if (gSavedSettings.getS32("MeshUploadFakeErrors")&2) + { + cc = llsd_from_file("fake_upload_error.xml"); + } + //assert_main_thread(); mThread->mPendingUploads--; - dumpLLSDToFile(content,make_dump_name("whole_model_upload_response_",dump_num)); - llinfos << "LLWholeModelUploadResponder content: " << content << llendl; + dump_llsd_to_file(cc,make_dump_name("whole_model_upload_response_",dump_num)); + llinfos << "LLWholeModelUploadResponder content: " << cc << llendl; // requested "mesh" asset type isn't actually the type // of the resultant object, fix it up here. if (isGoodStatus(status) && - content["state"].asString() == "complete") + cc["state"].asString() == "complete") { llinfos << "upload succeeded" << llendl; - mPostData["asset_type"] = "object"; - gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mPostData,content)); + mModelData["asset_type"] = "object"; + gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mModelData,cc)); } else { llwarns << "upload failed" << llendl; - log_upload_error(status,content,"upload"); + std::string model_name = mModelData["name"].asString(); + log_upload_error(status,cc,"upload",model_name); } } }; @@ -1418,7 +1444,7 @@ void LLMeshUploadThread::run() doWholeModelUpload(); } -void dumpLLSDToFile(const LLSD& content, std::string filename) +void dump_llsd_to_file(const LLSD& content, std::string filename) { if (gSavedSettings.getBOOL("MeshUploadLogXML")) { @@ -1427,6 +1453,14 @@ void dumpLLSDToFile(const LLSD& content, std::string filename) } } +LLSD llsd_from_file(std::string filename) +{ + std::ifstream ifs(filename); + LLSD result; + LLSDSerialize::fromXML(result,ifs); + return result; +} + void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) { LLSD result; @@ -1595,7 +1629,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) } result["asset_resources"] = res; - dumpLLSDToFile(result,make_dump_name("whole_model_",dump_num)); + dump_llsd_to_file(result,make_dump_name("whole_model_",dump_num)); dest = result; } @@ -1651,12 +1685,12 @@ void LLMeshUploadThread::doWholeModelUpload() LLSD model_data; wholeModelToLLSD(model_data,false); - dumpLLSDToFile(model_data,make_dump_name("whole_model_fee_request_",dump_num)); + dump_llsd_to_file(model_data,make_dump_name("whole_model_fee_request_",dump_num)); mPendingUploads++; LLCurlRequest::headers_t headers; mCurlRequest->post(mWholeModelFeeCapability, headers, model_data, - new LLWholeModelFeeResponder(this)); + new LLWholeModelFeeResponder(this,model_data)); do { @@ -1673,7 +1707,7 @@ void LLMeshUploadThread::doWholeModelUpload() LLSD full_model_data; wholeModelToLLSD(full_model_data, true); LLSD body = full_model_data["asset_resources"]; - dumpLLSDToFile(body,make_dump_name("whole_model_body_",dump_num)); + dump_llsd_to_file(body,make_dump_name("whole_model_body_",dump_num)); mCurlRequest->post(mWholeModelUploadURL, headers, body, new LLWholeModelUploadResponder(this, model_data)); do @@ -3111,8 +3145,8 @@ bool LLImportMaterial::operator<(const LLImportMaterial &rhs) const void LLMeshRepository::updateInventory(inventory_data data) { LLMutexLock lock(mMeshMutex); - dumpLLSDToFile(data.mPostData,make_dump_name("update_inventory_post_data_",dump_num)); - dumpLLSDToFile(data.mResponse,make_dump_name("update_inventory_response_",dump_num)); + dump_llsd_to_file(data.mPostData,make_dump_name("update_inventory_post_data_",dump_num)); + dump_llsd_to_file(data.mResponse,make_dump_name("update_inventory_response_",dump_num)); mInventoryQ.push(data); } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index ce96c488b4..c8d1d6c9fd 100644..100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6823,7 +6823,7 @@ Select residents to share with. name="MeshUploadError" icon="alert.tga" type="alert"> - [LABEL] failed to upload: [MESSAGE] [IDENTIFIER] [INVALIDITY_IDENTIFIER] + [LABEL] failed to upload: [MESSAGE] [IDENTIFIER] </notification> <notification |