summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorymodel.cpp
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2014-09-22 18:49:45 -0400
committerMonty Brandenberg <monty@lindenlab.com>2014-09-22 18:49:45 -0400
commit329608d24668b044e16b54ff7a7d0ac592b2b88d (patch)
treec64f395007ada36f78fcb691923d98e1c75e1b4b /indra/newview/llinventorymodel.cpp
parent11036d7bf471953ada9b877b8d9ce9de4b94dc5b (diff)
Tuning and documentation. Use a fast poll frequency (0.05S)
on the HTTP requests for inventory. We'll benchmark with that and see how it goes. Document some of the history of the background fetcher for future devs. Suggest some future projects to make things faster. Pointers on using LLSD with the llcorehttp library in the readme. And restructured the LLSD onCompleted() processing phases using do{}while(false) which produced a code flow that is fairly attractive.
Diffstat (limited to 'indra/newview/llinventorymodel.cpp')
-rwxr-xr-xindra/newview/llinventorymodel.cpp92
1 files changed, 45 insertions, 47 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index ee28cef640..dab3a4c06d 100755
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -3974,65 +3974,63 @@ LLInventoryModel::FetchItemHttpHandler::~FetchItemHttpHandler()
void LLInventoryModel::FetchItemHttpHandler::onCompleted(LLCore::HttpHandle handle,
LLCore::HttpResponse * response)
{
- // Single-pass do-while used for common exit handling
- do
+ do // Single-pass do-while used for common exit handling
{
LLCore::HttpStatus status(response->getStatus());
// status = LLCore::HttpStatus(404); // Dev tool to force error handling
if (! status)
{
processFailure(status, response);
+ break; // Goto common exit
}
- else
- {
- LLCore::BufferArray * body(response->getBody());
- // body = NULL; // Dev tool to force error handling
- if (! body || ! body->size())
- {
- LL_WARNS(LOG_INV) << "Missing data in inventory item query." << LL_ENDL;
- processFailure("HTTP response for inventory item query missing body", response);
- break; // Goto common exit
- }
- // body->write(0, "Garbage Response", 16); // Dev tool to force error handling
- LLSD body_llsd;
- if (! LLCoreHttpUtil::responseToLLSD(response, true, body_llsd))
- {
- // INFOS-level logging will occur on the parsed failure
- processFailure("HTTP response for inventory item query has malformed LLSD", response);
- break; // Goto common exit
- }
+ LLCore::BufferArray * body(response->getBody());
+ // body = NULL; // Dev tool to force error handling
+ if (! body || ! body->size())
+ {
+ LL_WARNS(LOG_INV) << "Missing data in inventory item query." << LL_ENDL;
+ processFailure("HTTP response for inventory item query missing body", response);
+ break; // Goto common exit
+ }
- // Expect top-level structure to be a map
- // body_llsd = LLSD::emptyArray(); // Dev tool to force error handling
- if (! body_llsd.isMap())
- {
- processFailure("LLSD response for inventory item not a map", response);
- break; // Goto common exit
- }
+ // body->write(0, "Garbage Response", 16); // Dev tool to force error handling
+ LLSD body_llsd;
+ if (! LLCoreHttpUtil::responseToLLSD(response, true, body_llsd))
+ {
+ // INFOS-level logging will occur on the parsed failure
+ processFailure("HTTP response for inventory item query has malformed LLSD", response);
+ break; // Goto common exit
+ }
- // 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";
- if (body_llsd.has("error"))
- {
- processFailure("Inventory application error (200-with-error)", response);
- break; // Goto common exit
- }
+ // Expect top-level structure to be a map
+ // body_llsd = LLSD::emptyArray(); // Dev tool to force error handling
+ if (! body_llsd.isMap())
+ {
+ processFailure("LLSD response for inventory item not a map", response);
+ break; // Goto common exit
+ }
- // Okay, process data if possible
- processData(body_llsd, response);
+ // 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";
+ if (body_llsd.has("error"))
+ {
+ processFailure("Inventory application error (200-with-error)", response);
+ break; // Goto common exit
}
+
+ // Okay, process data if possible
+ processData(body_llsd, response);
}
while (false);