summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2014-09-09 15:36:35 -0400
committerMonty Brandenberg <monty@lindenlab.com>2014-09-09 15:36:35 -0400
commitf71c6c745bc390fadc571801a0d7c043249ade24 (patch)
treee251a27529286aea9a25fcd42d7652be2a9f1735
parentac62e322ce0060758afca2007469dd25a3d64d48 (diff)
Cleanup pass. Documentation. Get older llcorehttp-using
code to use utils for any LLSD interfaces.
-rw-r--r--indra/llmessage/llcorehttputil.cpp4
-rwxr-xr-xindra/newview/llinventorymodel.cpp14
-rwxr-xr-xindra/newview/llinventorymodelbackgroundfetch.cpp28
-rwxr-xr-xindra/newview/llmeshrepository.cpp64
-rwxr-xr-xindra/newview/lltexturefetch.cpp34
5 files changed, 78 insertions, 66 deletions
diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp
index 8d09aac971..ee80b0fd94 100644
--- a/indra/llmessage/llcorehttputil.cpp
+++ b/indra/llmessage/llcorehttputil.cpp
@@ -39,7 +39,9 @@ using namespace LLCore;
namespace LLCoreHttpUtil
{
-
+// *TODO: Currently converts only from XML content. A mode
+// to convert using fromBinary() might be useful as well. Mesh
+// headers could use it.
bool responseToLLSD(HttpResponse * response, bool log, LLSD & out_llsd)
{
// Convert response to LLSD
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 5273fb6d96..1625ae0d1b 100755
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -3958,7 +3958,10 @@ BOOL decompress_file(const char* src_filename, const char* dst_filename)
}
#endif
-// ==== FetchItemHttpHandler ====
+
+///----------------------------------------------------------------------------
+/// Class LLInventoryModel::FetchItemHttpHandler
+///----------------------------------------------------------------------------
LLInventoryModel::FetchItemHttpHandler::FetchItemHttpHandler(const LLSD & request_sd)
: LLCore::HttpHandler(),
@@ -4006,6 +4009,15 @@ void LLInventoryModel::FetchItemHttpHandler::onCompleted(LLCore::HttpHandle hand
}
// Check for 200-with-error failures
+ //
+ // Original Responder-based serivce model didn't check for these errors.
+ // It may be more robust to ignore this condition. With aggregated requests,
+ // an error in one inventory item might take down the entire request.
+ // So if this instead broke up the aggregated items into single requests,
+ // maybe that would make progress. Or perhaps there's structured information
+ // that can tell us what went wrong. Need to dig into this and firm up
+ // the API.
+ //
// body_llsd["error"] = LLSD::emptyMap(); // Dev tool to force error handling
// body_llsd["error"]["identifier"] = "Development";
// body_llsd["error"]["message"] = "You left development code in the viewer";
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index 0c04a9c039..013134843a 100755
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -45,6 +45,10 @@
namespace
{
+///----------------------------------------------------------------------------
+/// Class <anonymous>::BGItemHttpHandler
+///----------------------------------------------------------------------------
+
//
// Http request handler class for single inventory item requests.
//
@@ -80,6 +84,10 @@ protected:
};
+///----------------------------------------------------------------------------
+/// Class <anonymous>::BGFolderHttpHandler
+///----------------------------------------------------------------------------
+
// Http request handler class for folders.
//
// Handler for FetchInventoryDescendents2 and FetchLibDescendents2
@@ -130,6 +138,10 @@ const char * const LOG_INV("Inventory");
} // end of namespace anonymous
+///----------------------------------------------------------------------------
+/// Class LLInventoryModelBackgroundFetch
+///----------------------------------------------------------------------------
+
LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch():
mBackgroundFetchActive(FALSE),
mFolderFetchActive(false),
@@ -684,14 +696,12 @@ bool LLInventoryModelBackgroundFetch::fetchQueueContainsNoDescendentsOf(const LL
}
-// ===============================
-// Anonymous Namespace Definitions
-// ===============================
-
namespace
{
-// ==== BGFolderHttpHandler ====
+///----------------------------------------------------------------------------
+/// Class <anonymous>::BGFolderHttpHandler
+///----------------------------------------------------------------------------
void BGFolderHttpHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response)
{
@@ -734,6 +744,9 @@ void BGFolderHttpHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRes
}
// Check for 200-with-error failures
+ //
+ // See comments in llinventorymodel.cpp about this mode of error.
+ //
// body_llsd["error"] = LLSD::emptyMap(); // Dev tool to force error handling
// body_llsd["error"]["identifier"] = "Development";
// body_llsd["error"]["message"] = "You left development code in the viewer";
@@ -976,8 +989,9 @@ bool BGFolderHttpHandler::getIsRecursive(const LLUUID & cat_id) const
return std::find(mRecursiveCatUUIDs.begin(), mRecursiveCatUUIDs.end(), cat_id) != mRecursiveCatUUIDs.end();
}
-
-// ==== BGItemHttpHandler ====
+///----------------------------------------------------------------------------
+/// Class <anonymous>::BGItemHttpHandler
+///----------------------------------------------------------------------------
// Nothing to implement here. All ctor/dtor changes.
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index a6707392fe..2b044c6916 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -71,6 +71,7 @@
#include "bufferarray.h"
#include "bufferstream.h"
#include "llfasttimer.h"
+#include "llcorehttputil.h"
#include "boost/lexical_cast.hpp"
@@ -2236,21 +2237,17 @@ void LLMeshUploadThread::doWholeModelUpload()
mModelData = LLSD::emptyMap();
wholeModelToLLSD(mModelData, true);
LLSD body = mModelData["asset_resources"];
- dump_llsd_to_file(body,make_dump_name("whole_model_body_",dump_num));
-
- LLCore::BufferArray * ba = new LLCore::BufferArray;
- LLCore::BufferArrayStream bas(ba);
- LLSDSerialize::toXML(body, bas);
- // LLSDSerialize::toXML(mModelData, bas); // <- Enabling this will generate a convenient upload error
- LLCore::HttpHandle handle = mHttpRequest->requestPost(mHttpPolicyClass,
- mHttpPriority,
- mWholeModelUploadURL,
- ba,
- mHttpOptions,
- mHttpHeaders,
- this);
- ba->release();
-
+
+ dump_llsd_to_file(body, make_dump_name("whole_model_body_", dump_num));
+
+ LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest,
+ mHttpPolicyClass,
+ mHttpPriority,
+ mWholeModelUploadURL,
+ body,
+ mHttpOptions,
+ mHttpHeaders,
+ this);
if (LLCORE_HTTP_HANDLE_INVALID == handle)
{
mHttpStatus = mHttpRequest->getStatus();
@@ -2294,19 +2291,14 @@ void LLMeshUploadThread::requestWholeModelFee()
mModelData = LLSD::emptyMap();
wholeModelToLLSD(mModelData, false);
dump_llsd_to_file(mModelData, make_dump_name("whole_model_fee_request_", dump_num));
-
- LLCore::BufferArray * ba = new LLCore::BufferArray;
- LLCore::BufferArrayStream bas(ba);
- LLSDSerialize::toXML(mModelData, bas);
-
- LLCore::HttpHandle handle = mHttpRequest->requestPost(mHttpPolicyClass,
- mHttpPriority,
- mWholeModelFeeCapability,
- ba,
- mHttpOptions,
- mHttpHeaders,
- this);
- ba->release();
+ LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest,
+ mHttpPolicyClass,
+ mHttpPriority,
+ mWholeModelFeeCapability,
+ mModelData,
+ mHttpOptions,
+ mHttpHeaders,
+ this);
if (LLCORE_HTTP_HANDLE_INVALID == handle)
{
mHttpStatus = mHttpRequest->getStatus();
@@ -2379,12 +2371,8 @@ void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResp
}
else
{
- LLCore::BufferArray * ba(response->getBody());
- if (ba && ba->size())
- {
- LLCore::BufferArrayStream bas(ba);
- LLSDSerialize::fromXML(body, bas);
- }
+ // *TODO: handle error in conversion process
+ LLCoreHttpUtil::responseToLLSD(response, true, body);
}
dump_llsd_to_file(body, make_dump_name("whole_model_upload_response_", dump_num));
@@ -2443,12 +2431,8 @@ void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResp
}
else
{
- LLCore::BufferArray * ba(response->getBody());
- if (ba && ba->size())
- {
- LLCore::BufferArrayStream bas(ba);
- LLSDSerialize::fromXML(body, bas);
- }
+ // *TODO: handle error in conversion process
+ LLCoreHttpUtil::responseToLLSD(response, true, body);
}
dump_llsd_to_file(body, make_dump_name("whole_model_fee_response_", dump_num));
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index a64a6ee091..a955b907d4 100755
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -56,13 +56,13 @@
#include "llsdparam.h"
#include "llsdutil.h"
#include "llstartup.h"
-#include "llsdserialize.h"
#include "httprequest.h"
#include "httphandler.h"
#include "httpresponse.h"
#include "bufferarray.h"
#include "bufferstream.h"
+#include "llcorehttputil.h"
#include "llhttpretrypolicy.h"
@@ -1349,20 +1349,20 @@ bool LLTextureFetchWorker::doWork(S32 param)
LL_WARNS(LOG_TXT) << "trying to seek a non-default texture on the sim. Bad!" << LL_ENDL;
}
setUrl(http_url + "/?texture_id=" + mID.asString().c_str());
- LL_DEBUGS("Texture") << "Texture URL " << mUrl << LL_ENDL;
+ LL_DEBUGS(LOG_TXT) << "Texture URL: " << mUrl << LL_ENDL;
mWriteToCacheState = CAN_WRITE ; //because this texture has a fixed texture id.
}
else
{
mCanUseHTTP = false ;
- LL_DEBUGS("Texture") << "Texture not available via HTTP: no URL " << mUrl << LL_ENDL;
+ LL_DEBUGS(LOG_TXT) << "Texture not available via HTTP: empty URL." << LL_ENDL;
}
}
else
{
// This will happen if not logged in or if a region deoes not have HTTP Texture enabled
//LL_WARNS(LOG_TXT) << "Region not found for host: " << mHost << LL_ENDL;
- LL_DEBUGS("Texture") << "Texture not available via HTTP: no region " << mUrl << LL_ENDL;
+ LL_DEBUGS(LOG_TXT) << "Texture not available via HTTP: no region " << mUrl << LL_ENDL;
mCanUseHTTP = false;
}
}
@@ -4026,7 +4026,9 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
// Update sequence number
if (S32_MAX == ++report_sequence)
+ {
report_sequence = 0;
+ }
reporting_started = true;
// Limit the size of the stats report if necessary.
@@ -4035,18 +4037,16 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
if (! mCapsURL.empty())
{
- LLCore::BufferArray * ba = new LLCore::BufferArray;
- LLCore::BufferArrayStream bas(ba);
- LLSDSerialize::toXML(sd, bas);
-
- fetcher->getHttpRequest().requestPost(fetcher->getPolicyClass(),
- report_priority,
- mCapsURL,
- ba,
- NULL,
- fetcher->getMetricsHeaders(),
- handler);
- ba->release();
+ // *TODO: Move this to a different class that expects POSTs sometime.
+ // Don't care about handle, this is a fire-and-forget operation.
+ LLCoreHttpUtil::requestPostWithLLSD(&fetcher->getHttpRequest(),
+ fetcher->getPolicyClass(),
+ report_priority,
+ mCapsURL,
+ sd,
+ NULL,
+ fetcher->getMetricsHeaders(),
+ handler);
LLTextureFetch::svMetricsDataBreak = false;
}
else
@@ -4057,7 +4057,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
// In QA mode, Metrics submode, log the result for ease of testing
if (fetcher->isQAMode())
{
- LL_INFOS("Textures") << ll_pretty_print_sd(sd) << LL_ENDL;
+ LL_INFOS(LOG_TXT) << ll_pretty_print_sd(sd) << LL_ENDL;
}
return true;