diff options
Diffstat (limited to 'indra/newview/llaisapi.cpp')
-rw-r--r-- | indra/newview/llaisapi.cpp | 81 |
1 files changed, 49 insertions, 32 deletions
diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index f26549cc3d..4546574955 100644 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -703,8 +703,12 @@ void AISAPI::FetchCOF(completion_t callback) // _6 -> httpHeaders (&LLCoreHttpUtil::HttpCoroutineAdapter::getAndSuspend), _1, _2, _3, _5, _6); + LLSD body; + // Only cof folder will be full, but cof can contain an outfit + // link with embedded outfit folder for request to parse + body["depth"] = 0; LLCoprocedureManager::CoProcedure_t proc(boost::bind(&AISAPI::InvokeAISCommandCoro, - _1, getFn, url, LLUUID::null, LLSD(), callback, FETCHCOF)); + _1, getFn, url, LLUUID::null, body, callback, FETCHCOF)); EnqueueAISCommand("FetchCOF", proc); } @@ -982,6 +986,7 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht case FETCHITEM: if (result.has("item_id")) { + // Error message might contain an item_id!!! id = result["item_id"]; } if (result.has("linked_id")) @@ -1163,11 +1168,15 @@ void AISUpdate::parseMeta(const LLSD& update) void AISUpdate::parseContent(const LLSD& update) { - if (update.has("linked_id")) + // Errors from a fetch request might contain id without + // full item or folder. + // Todo: Depending on error we might want to do something, + // like removing a 404 item or refetching parent folder + if (update.has("linked_id") && update.has("parent_id")) { parseLink(update, mFetchDepth); } - else if (update.has("item_id")) + else if (update.has("item_id") && update.has("parent_id")) { parseItem(update); } @@ -1181,7 +1190,7 @@ void AISUpdate::parseContent(const LLSD& update) parseEmbedded(update["_embedded"], mFetchDepth - 1); } } - else if (update.has("category_id")) + else if (update.has("category_id") && update.has("parent_id")) { parseCategory(update, mFetchDepth); } @@ -1210,7 +1219,6 @@ void AISUpdate::parseItem(const LLSD& item_map) if (mFetch) { mItemsCreated[item_id] = new_item; - mCatDescendentDeltas[new_item->getParentUUID()]; new_item->setComplete(true); if (new_item->getParentUUID().isNull()) @@ -1264,7 +1272,6 @@ void AISUpdate::parseLink(const LLSD& link_map, S32 depth) new_link->setSaleInfo(default_sale_info); //LL_DEBUGS("Inventory") << "creating link from llsd: " << ll_pretty_print_sd(link_map) << LL_ENDL; mItemsCreated[item_id] = new_link; - mCatDescendentDeltas[parent_id]; new_link->setComplete(true); if (new_link->getParentUUID().isNull()) @@ -1361,17 +1368,6 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth) { if (mFetch) { - // set version only if previous one was already known - // or if we are sure this update has full data and embeded items (depth 0+) - // since bulk fetch uses this to decide what still needs fetching - if (version > LLViewerInventoryCategory::VERSION_UNKNOWN - && (depth >= 0 || (curr_cat && curr_cat->getVersion() > LLViewerInventoryCategory::VERSION_UNKNOWN))) - { - // Set version/descendents for newly fetched categories. - LL_DEBUGS("Inventory") << "Setting version to " << version - << " for category " << category_id << LL_ENDL; - new_cat->setVersion(version); - } uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id); if (mCatDescendentsKnown.end() != lookup_it) { @@ -1379,9 +1375,28 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth) LL_DEBUGS("Inventory") << "Setting descendents count to " << descendent_count << " for category " << category_id << LL_ENDL; new_cat->setDescendentCount(descendent_count); + + // set version only if we are sure this update has full data and embeded items + // since viewer uses version to decide if folder and content still need fetching + if (version > LLViewerInventoryCategory::VERSION_UNKNOWN + && (depth >= 0 || (curr_cat && curr_cat->getVersion() > LLViewerInventoryCategory::VERSION_UNKNOWN))) + { + LL_DEBUGS("Inventory") << "Setting version to " << version + << " for category " << category_id << LL_ENDL; + new_cat->setVersion(version); + } + } + else if (curr_cat + && curr_cat->getVersion() > LLViewerInventoryCategory::VERSION_UNKNOWN + && version > curr_cat->getVersion()) + { + // Potentially should new_cat->setVersion(unknown) here, + // but might be waiting for a callback that would increment + LL_DEBUGS("Inventory") << "Category " << category_id + << " is stale. Known version: " << curr_cat->getVersion() + << " server version: " << version << LL_ENDL; } mCategoriesCreated[category_id] = new_cat; - mCatDescendentDeltas[new_cat->getParentUUID()]; } else if (curr_cat) { @@ -1396,20 +1411,22 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth) else { // Set version/descendents for newly created categories. - if (category_map.has("version")) - { - S32 version = category_map["version"].asInteger(); - LL_DEBUGS("Inventory") << "Setting version to " << version - << " for new category " << category_id << LL_ENDL; - new_cat->setVersion(version); - } - uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id); - if (mCatDescendentsKnown.end() != lookup_it) - { - S32 descendent_count = lookup_it->second; - LL_DEBUGS("Inventory") << "Setting descendents count to " << descendent_count - << " for new category " << category_id << LL_ENDL; - new_cat->setDescendentCount(descendent_count); + uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id); + if (mCatDescendentsKnown.end() != lookup_it) + { + S32 descendent_count = lookup_it->second; + LL_DEBUGS("Inventory") << "Setting descendents count to " << descendent_count + << " for new category " << category_id << LL_ENDL; + new_cat->setDescendentCount(descendent_count); + + // Don't set version unles correct children count is present + if (category_map.has("version")) + { + S32 version = category_map["version"].asInteger(); + LL_DEBUGS("Inventory") << "Setting version to " << version + << " for new category " << category_id << LL_ENDL; + new_cat->setVersion(version); + } } mCategoriesCreated[category_id] = new_cat; mCatDescendentDeltas[new_cat->getParentUUID()]++; |