- fixed : questionable code is questionable (aka LLAttachmentsMgr::checkInvalidCOFLinks seems redundant)

-> the way to trigger the function seems to be (with the proper timing sequence):
        * Script an attachment to detach on attach
        * Wear the attachment => link creation request is sent
        * Detach the attachment => link is still pending so can't be removed
        * Link is created => at some point in time the function notices an unworn COF link and removes it
    -> Appearance-SyncAttach will verify the attachment is still worn when the link is created so if the above is the use case for this function then we're already handling it
    -> failing the catch by onRegisterAttachmentComplete the attachment will be re-attached by updateAppearanceFromCOF (which will happen with the LL function if an item is worn before the time-out kicks in)

--HG--
branch : Appearance-Misc
meow-7.2.2
Kitty Barnett 2015-06-25 03:53:47 +02:00
parent 676d913fb4
commit 332b4a40e1
2 changed files with 57 additions and 57 deletions

View File

@ -43,8 +43,8 @@ const F32 MAX_BAD_COF_TIME = 30.0F;
LLAttachmentsMgr::LLAttachmentsMgr():
mAttachmentRequests("attach",MIN_RETRY_REQUEST_TIME),
mDetachRequests("detach",MIN_RETRY_REQUEST_TIME),
mQuestionableCOFLinks("badcof",MAX_BAD_COF_TIME)
mDetachRequests("detach",MIN_RETRY_REQUEST_TIME)
// , mQuestionableCOFLinks("badcof",MAX_BAD_COF_TIME)
{
}
@ -117,7 +117,7 @@ void LLAttachmentsMgr::onIdle()
expireOldDetachRequests();
checkInvalidCOFLinks();
// checkInvalidCOFLinks();
spamStatusInfo();
}
@ -428,9 +428,9 @@ void LLAttachmentsMgr::onDetachCompleted(const LLUUID& inv_item_id)
<< (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL;
}
LL_DEBUGS("Avatar") << "ATT detached item flagging as questionable for COF link checking "
<< (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL;
mQuestionableCOFLinks.addTime(inv_item_id);
// LL_DEBUGS("Avatar") << "ATT detached item flagging as questionable for COF link checking "
// << (item ? item->getName() : "UNKNOWN") << " id " << inv_item_id << LL_ENDL;
// mQuestionableCOFLinks.addTime(inv_item_id);
}
// Check for attachments that are (a) linked in COF and (b) not
@ -453,54 +453,54 @@ void LLAttachmentsMgr::onDetachCompleted(const LLUUID& inv_item_id)
//
// See related: MAINT-5070, MAINT-4409
//
void LLAttachmentsMgr::checkInvalidCOFLinks()
{
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t item_array;
gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(),
cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH);
for (S32 i=0; i<item_array.size(); i++)
{
const LLViewerInventoryItem* inv_item = item_array.at(i).get();
const LLUUID& item_id = inv_item->getLinkedUUID();
if (inv_item->getType() == LLAssetType::AT_OBJECT)
{
LLTimer timer;
bool is_flagged_questionable = mQuestionableCOFLinks.getTime(item_id,timer);
bool is_wearing_attachment = isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item_id);
if (is_wearing_attachment && is_flagged_questionable)
{
LL_DEBUGS("Avatar") << "ATT was flagged questionable but is now "
<< (is_wearing_attachment ? "attached " : "")
<<"removing flag after "
<< timer.getElapsedTimeF32() << " item "
<< inv_item->getName() << " id " << item_id << LL_ENDL;
mQuestionableCOFLinks.removeTime(item_id);
}
}
}
for(LLItemRequestTimes::iterator it = mQuestionableCOFLinks.begin();
it != mQuestionableCOFLinks.end(); )
{
LLItemRequestTimes::iterator curr_it = it;
++it;
const LLUUID& item_id = curr_it->first;
LLViewerInventoryItem *inv_item = gInventory.getItem(item_id);
if (curr_it->second.getElapsedTimeF32() > MAX_BAD_COF_TIME)
{
if (LLAppearanceMgr::instance().isLinkedInCOF(item_id))
{
LL_DEBUGS("Avatar") << "ATT Linked in COF but not attached or requested, deleting link after "
<< curr_it->second.getElapsedTimeF32() << " seconds for "
<< (inv_item ? inv_item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
LLAppearanceMgr::instance().removeCOFItemLinks(item_id);
}
mQuestionableCOFLinks.erase(curr_it);
continue;
}
}
}
//void LLAttachmentsMgr::checkInvalidCOFLinks()
//{
// LLInventoryModel::cat_array_t cat_array;
// LLInventoryModel::item_array_t item_array;
// gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(),
// cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH);
// for (S32 i=0; i<item_array.size(); i++)
// {
// const LLViewerInventoryItem* inv_item = item_array.at(i).get();
// const LLUUID& item_id = inv_item->getLinkedUUID();
// if (inv_item->getType() == LLAssetType::AT_OBJECT)
// {
// LLTimer timer;
// bool is_flagged_questionable = mQuestionableCOFLinks.getTime(item_id,timer);
// bool is_wearing_attachment = isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item_id);
// if (is_wearing_attachment && is_flagged_questionable)
// {
// LL_DEBUGS("Avatar") << "ATT was flagged questionable but is now "
// << (is_wearing_attachment ? "attached " : "")
// <<"removing flag after "
// << timer.getElapsedTimeF32() << " item "
// << inv_item->getName() << " id " << item_id << LL_ENDL;
// mQuestionableCOFLinks.removeTime(item_id);
// }
// }
// }
//
// for(LLItemRequestTimes::iterator it = mQuestionableCOFLinks.begin();
// it != mQuestionableCOFLinks.end(); )
// {
// LLItemRequestTimes::iterator curr_it = it;
// ++it;
// const LLUUID& item_id = curr_it->first;
// LLViewerInventoryItem *inv_item = gInventory.getItem(item_id);
// if (curr_it->second.getElapsedTimeF32() > MAX_BAD_COF_TIME)
// {
// if (LLAppearanceMgr::instance().isLinkedInCOF(item_id))
// {
// LL_DEBUGS("Avatar") << "ATT Linked in COF but not attached or requested, deleting link after "
// << curr_it->second.getElapsedTimeF32() << " seconds for "
// << (inv_item ? inv_item->getName() : "UNKNOWN") << " id " << item_id << LL_ENDL;
// LLAppearanceMgr::instance().removeCOFItemLinks(item_id);
// }
// mQuestionableCOFLinks.erase(curr_it);
// continue;
// }
// }
//}
void LLAttachmentsMgr::spamStatusInfo()
{

View File

@ -109,7 +109,7 @@ private:
void linkRecentlyArrivedAttachments();
void expireOldAttachmentRequests();
void expireOldDetachRequests();
void checkInvalidCOFLinks();
// void checkInvalidCOFLinks();
void spamStatusInfo();
// Attachments that we are planning to rez but haven't requested from the server yet.
@ -125,8 +125,8 @@ private:
std::set<LLUUID> mRecentlyArrivedAttachments;
LLTimer mCOFLinkBatchTimer;
// Attachments that are linked in the COF but may be invalid.
LLItemRequestTimes mQuestionableCOFLinks;
// // Attachments that are linked in the COF but may be invalid.
// LLItemRequestTimes mQuestionableCOFLinks;
};
#endif