summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/_httprequestqueue.cpp
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2012-06-21 21:32:33 -0400
committerMonty Brandenberg <monty@lindenlab.com>2012-06-21 21:32:33 -0400
commited5db306545e414a1c975c1fff5908b6c2fe1389 (patch)
tree9bc2aed2a3ef7fa2d7a49ebc67a64f63890d24e0 /indra/llcorehttp/_httprequestqueue.cpp
parenteed28348f2668c93bc572cffd8a284e65228ed02 (diff)
Preparing for better shutdown/cleanup logic.
Diffstat (limited to 'indra/llcorehttp/_httprequestqueue.cpp')
-rw-r--r--indra/llcorehttp/_httprequestqueue.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/indra/llcorehttp/_httprequestqueue.cpp b/indra/llcorehttp/_httprequestqueue.cpp
index 92bb5ec5c1..6487ef6fa5 100644
--- a/indra/llcorehttp/_httprequestqueue.cpp
+++ b/indra/llcorehttp/_httprequestqueue.cpp
@@ -39,7 +39,8 @@ HttpRequestQueue * HttpRequestQueue::sInstance(NULL);
HttpRequestQueue::HttpRequestQueue()
- : RefCounted(true)
+ : RefCounted(true),
+ mQueueStopped(false)
{
}
@@ -72,14 +73,25 @@ void HttpRequestQueue::term()
}
-void HttpRequestQueue::addOp(HttpOperation * op)
+HttpStatus HttpRequestQueue::addOp(HttpOperation * op)
{
+ bool wake(false);
{
HttpScopedLock lock(mQueueMutex);
+ if (mQueueStopped)
+ {
+ // Return op and error to caller
+ return HttpStatus(HttpStatus::LLCORE, HE_SHUTTING_DOWN);
+ }
+ wake = mQueue.empty();
mQueue.push_back(op);
}
- mQueueCV.notify_all();
+ if (wake)
+ {
+ mQueueCV.notify_all();
+ }
+ return HttpStatus();
}
@@ -129,4 +141,15 @@ void HttpRequestQueue::fetchAll(bool wait, OpContainer & ops)
return;
}
+
+void HttpRequestQueue::stopQueue()
+{
+ {
+ HttpScopedLock lock(mQueueMutex);
+
+ mQueueStopped = true;
+ }
+}
+
+
} // end namespace LLCore