Fixed a bug that lost callbacks if > 10 experiences were looked up at a time.

master
dolphin 2014-03-10 10:15:19 -07:00
parent 96457e1aff
commit 7b9817cbcc
7 changed files with 64 additions and 39 deletions

View File

@ -415,40 +415,39 @@ namespace LLExperienceCache
F64 now = LLFrameTimer::getTotalSeconds();
const U32 EXP_URL_SEND_THRESHOLD = 3000;
const U32 PAGE_SIZE = EXP_URL_SEND_THRESHOLD/UUID_STR_LENGTH;
std::ostringstream ostr;
ask_queue_t keys;
ostr << sLookupURL;
ostr << sLookupURL << "?page_size=" << PAGE_SIZE;
char arg='?';
int request_count = 0;
for(ask_queue_t::const_iterator it = sAskQueue.begin() ; it != sAskQueue.end() && request_count < sMaximumLookups; ++it)
while(!sAskQueue.empty() && request_count < sMaximumLookups)
{
ask_queue_t::const_iterator it = sAskQueue.begin();
const LLUUID& key = it->first;
const std::string& key_type = it->second;
ostr << arg << key_type << '=' << key.asString() ;
ostr << '&' << key_type << '=' << key.asString() ;
keys[key]=key_type;
request_count++;
sPendingQueue[key] = now;
arg='&';
if(ostr.tellp() > EXP_URL_SEND_THRESHOLD)
{
LL_DEBUGS("ExperienceCache") << "requestExperiences() query: " << ostr.str() << LL_ENDL;
LLHTTPClient::get(ostr.str(), new LLExperienceResponder(keys));
ostr.clear();
ostr.str(sLookupURL);
arg='?';
ostr << "?page_size=" << PAGE_SIZE;
keys.clear();
}
sAskQueue.erase(it);
}
if(ostr.tellp() > sLookupURL.size())
@ -456,8 +455,6 @@ namespace LLExperienceCache
LL_DEBUGS("ExperienceCache") << "requestExperiences() query 2: " << ostr.str() << LL_ENDL;
LLHTTPClient::get(ostr.str(), new LLExperienceResponder(keys));
}
sAskQueue.clear();
}
bool isRequestPending(const LLUUID& public_key)

View File

@ -439,7 +439,10 @@ void LLFloaterExperiencePicker::filterContent()
void LLFloaterExperiencePicker::onMaturity()
{
filterContent();
if(mResponse.has("experience_keys") && mResponse["experience_keys"].beginArray() != mResponse["experience_keys"].endArray())
{
filterContent();
}
}
bool LLFloaterExperiencePicker::isExperienceHidden( const LLSD& experience) const

View File

@ -1298,8 +1298,6 @@ void LLLiveLSLEditor::setExperienceIds( const LLSD& experience_ids )
void LLLiveLSLEditor::updateExperiencePanel()
{
BOOL editable = getIsModifiable();
if(mScriptEd->getAssociatedExperience().isNull())
{
mExperienceEnabled->set(FALSE);
@ -1317,43 +1315,67 @@ void LLLiveLSLEditor::updateExperiencePanel()
getChild<LLButton>("view_profile")->setVisible(FALSE);
}
else
{
mExperienceEnabled->setToolTip(getString("experience_enabled"));
mExperienceEnabled->setEnabled(editable);
mExperienceEnabled->set(TRUE);
mExperiences->setVisible(TRUE);
getChild<LLButton>("view_profile")->setVisible(TRUE);
{
mExperienceEnabled->setToolTip(getString("experience_enabled"));
mExperienceEnabled->setEnabled(getIsModifiable());
mExperiences->setVisible(TRUE);
buildExperienceList();
}
}
void LLLiveLSLEditor::addExperienceInfo(const LLSD& experience, BOOL enabled)
{
LLUUID id = experience[LLExperienceCache::EXPERIENCE_ID].asUUID();
EAddPosition position = (id == mScriptEd->getAssociatedExperience())?ADD_TOP:ADD_BOTTOM;
LLScrollListItem* item=mExperiences->add(experience[LLExperienceCache::NAME], id, position );
if(!enabled)
{
item->setEnabled(FALSE);
}
}
void LLLiveLSLEditor::buildExperienceList()
{
mExperiences->clearRows();
bool foundAssociated=false;
const LLUUID& associated = mScriptEd->getAssociatedExperience();
LLSD experience;
LLUUID last;
LLScrollListItem* item;
for(LLSD::array_const_iterator it = mExperienceIds.beginArray(); it != mExperienceIds.endArray(); ++it)
{
LLUUID id = it->asUUID();
foundAssociated |= (id == mScriptEd->getAssociatedExperience());
LLExperienceCache::get(id, boost::bind(&LLLiveLSLEditor::addExperienceInfo, this, _1, TRUE));
EAddPosition position = ADD_BOTTOM;
if(id == associated)
{
foundAssociated = true;
position = ADD_TOP;
}
if(LLExperienceCache::get(id, experience))
{
mExperiences->add(experience[LLExperienceCache::NAME].asString(), id, position);
}
else
{
mExperiences->add(getString("loading"), id, position);
last = id;
}
}
if(!foundAssociated )
{
LLExperienceCache::get(mScriptEd->getAssociatedExperience(), boost::bind(&LLLiveLSLEditor::addExperienceInfo, this, _1, FALSE));
if(LLExperienceCache::get(associated, experience))
{
item=mExperiences->add(experience[LLExperienceCache::NAME].asString(), associated, ADD_TOP);
}
else
{
item=mExperiences->add(getString("loading"), associated, ADD_TOP);
last = associated;
}
item->setEnabled(FALSE);
}
if(last.notNull())
{
mExperiences->setEnabled(FALSE);
LLExperienceCache::get(last, boost::bind(&LLLiveLSLEditor::buildExperienceList, this));
}
else
{
mExperiences->setEnabled(TRUE);
getChild<LLButton>("view_profile")->setVisible(TRUE);
}
}

View File

@ -240,7 +240,6 @@ public:
static void onToggleExperience(LLUICtrl *ui, void* userdata);
static void onViewProfile(LLUICtrl *ui, void* userdata);
void addExperienceInfo( const LLSD& experience, BOOL enabled );
void setExperienceIds(const LLSD& experience_ids);
void buildExperienceList();
void updateExperiencePanel();

View File

@ -10,7 +10,7 @@
min_width="325"
min_height="325"
width="358"
height="580">
height="660">
<floater.string
name="empty_slurl">
(none)
@ -42,7 +42,7 @@
<tab_container
hide_tabs="true"
follows="all"
height="540"
height="620"
layout="topleft"
left="5"
min_height="250"

View File

@ -37,6 +37,10 @@
name="add_experiences">
Select to add an experience
</floater.string>
<floater.string
name="loading">
Loading...
</floater.string>
<panel
bevel_style="none"

View File

@ -7003,7 +7003,7 @@ Unable to acquire a new experience:
<notification
icon="notify.tga"
name="TeleportedHomeExperienceRemoved"
persist="true"
persist="false"
type="notify">
You have been teleported from the region [region_name] for removing the experience secondlife:///app/experience/[public_id]/profile and are no longer permitted in the region.
<form name="form">
@ -7015,7 +7015,7 @@ Unable to acquire a new experience:
<notification
icon="notify.tga"
name="TrustedExperienceEntry"
persist="true"
persist="false"
type="notify">
You have been allowed into the region [region_name] by participating in the trusted experience secondlife:///app/experience/[public_id]/profile removing this experience may kick you from the region.
<form name="form">