summaryrefslogtreecommitdiff
path: root/indra/newview/llmediadataclient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llmediadataclient.cpp')
-rwxr-xr-xindra/newview/llmediadataclient.cpp119
1 files changed, 71 insertions, 48 deletions
diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp
index 986c14acff..badef4c7ae 100755
--- a/indra/newview/llmediadataclient.cpp
+++ b/indra/newview/llmediadataclient.cpp
@@ -371,67 +371,87 @@ BOOL LLMediaDataClient::QueueTimer::tick()
}
LLMediaDataClient::PriorityQueue &queue = *(mMDC->pRequestQueue);
-
- if (queue.empty())
+
+ if(!queue.empty())
{
- LL_DEBUGS("LLMediaDataClient") << "queue empty: " << queue << LL_ENDL;
- return TRUE;
+ LL_INFOS("LLMediaDataClient") << "QueueTimer::tick() started, queue is: " << queue << LL_ENDL;
}
- LL_INFOS("LLMediaDataClient") << "QueueTimer::tick() started, queue is: " << queue << LL_ENDL;
-
- // Peel one off of the items from the queue, and execute request
- request_ptr_t request = queue.top();
- llassert(!request.isNull());
- const LLMediaDataClientObject *object = (request.isNull()) ? NULL : request->getObject();
- bool performed_request = false;
- bool error = false;
- llassert(NULL != object);
- if (NULL != object && object->hasMedia())
+ // quick retry loop for cases where we shouldn't wait for the next timer tick
+ while(true)
{
- std::string url = request->getCapability();
- if (!url.empty())
+ if (queue.empty())
{
- const LLSD &sd_payload = request->getPayload();
- LL_INFOS("LLMediaDataClient") << "Sending request for " << *request << LL_ENDL;
-
- // Call the subclass for creating the responder
- LLHTTPClient::post(url, sd_payload, mMDC->createResponder(request));
- performed_request = true;
+ LL_DEBUGS("LLMediaDataClient") << "queue empty: " << queue << LL_ENDL;
+ return TRUE;
}
- else {
- LL_INFOS("LLMediaDataClient") << "NOT Sending request for " << *request << ": empty cap url!" << LL_ENDL;
- }
- }
- else {
- if (request.isNull())
+
+ // Peel one off of the items from the queue, and execute request
+ request_ptr_t request = queue.top();
+ llassert(!request.isNull());
+ const LLMediaDataClientObject *object = (request.isNull()) ? NULL : request->getObject();
+ bool performed_request = false;
+ bool error = false;
+ llassert(NULL != object);
+
+ if(object->isDead())
{
- LL_WARNS("LLMediaDataClient") << "Not Sending request: NULL request!" << LL_ENDL;
+ // This object has been marked dead. Pop it and move on to the next item in the queue immediately.
+ LL_INFOS("LLMediaDataClient") << "Skipping " << *request << ": object is dead!" << LL_ENDL;
+ queue.pop();
+ continue; // jump back to the start of the quick retry loop
}
- else if (NULL == object)
+
+ if (NULL != object && object->hasMedia())
{
- LL_WARNS("LLMediaDataClient") << "Not Sending request for " << *request << " NULL object!" << LL_ENDL;
+ std::string url = request->getCapability();
+ if (!url.empty())
+ {
+ const LLSD &sd_payload = request->getPayload();
+ LL_INFOS("LLMediaDataClient") << "Sending request for " << *request << LL_ENDL;
+
+ // Call the subclass for creating the responder
+ LLHTTPClient::post(url, sd_payload, mMDC->createResponder(request));
+ performed_request = true;
+ }
+ else {
+ LL_INFOS("LLMediaDataClient") << "NOT Sending request for " << *request << ": empty cap url!" << LL_ENDL;
+ }
}
- else if (!object->hasMedia())
- {
- LL_WARNS("LLMediaDataClient") << "Not Sending request for " << *request << " hasMedia() is false!" << LL_ENDL;
+ else {
+ if (request.isNull())
+ {
+ LL_WARNS("LLMediaDataClient") << "Not Sending request: NULL request!" << LL_ENDL;
+ }
+ else if (NULL == object)
+ {
+ LL_WARNS("LLMediaDataClient") << "Not Sending request for " << *request << " NULL object!" << LL_ENDL;
+ }
+ else if (!object->hasMedia())
+ {
+ LL_WARNS("LLMediaDataClient") << "Not Sending request for " << *request << " hasMedia() is false!" << LL_ENDL;
+ }
+ error = true;
}
- error = true;
- }
- bool exceeded_retries = request->getRetryCount() > mMDC->mMaxNumRetries;
- if (performed_request || exceeded_retries || error) // Try N times before giving up
- {
- if (exceeded_retries)
+ bool exceeded_retries = request->getRetryCount() > mMDC->mMaxNumRetries;
+ if (performed_request || exceeded_retries || error) // Try N times before giving up
{
- LL_WARNS("LLMediaDataClient") << "Could not send request " << *request << " for "
- << mMDC->mMaxNumRetries << " tries...popping object id " << object->getID() << LL_ENDL;
- // XXX Should we bring up a warning dialog??
+ if (exceeded_retries)
+ {
+ LL_WARNS("LLMediaDataClient") << "Could not send request " << *request << " for "
+ << mMDC->mMaxNumRetries << " tries...popping object id " << object->getID() << LL_ENDL;
+ // XXX Should we bring up a warning dialog??
+ }
+ queue.pop();
}
- queue.pop();
- }
- else {
- request->incRetryCount();
- }
+ else {
+ request->incRetryCount();
+ }
+
+ // end of quick retry loop -- any cases where we want to loop will use 'continue' to jump back to the start.
+ break;
+ }
+
LL_DEBUGS("LLMediaDataClient") << "QueueTimer::tick() finished, queue is now: " << (*(mMDC->pRequestQueue)) << LL_ENDL;
return queue.empty();
@@ -617,6 +637,9 @@ void LLObjectMediaNavigateClient::navigate(LLMediaDataClientObject *object, U8 t
sd_payload[LLTextureEntry::OBJECT_ID_KEY] = object->getID();
sd_payload[LLMediaEntry::CURRENT_URL_KEY] = url;
sd_payload[LLTextureEntry::TEXTURE_INDEX_KEY] = (LLSD::Integer)texture_index;
+
+ LL_INFOS("LLMediaDataClient") << "navigate() initiated: " << ll_print_sd(sd_payload) << LL_ENDL;
+
request(object, sd_payload);
}