summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/_httpservice.h
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2012-06-01 14:07:34 -0400
committerMonty Brandenberg <monty@lindenlab.com>2012-06-01 14:07:34 -0400
commitb8edacd0bb4feacc3ac1d61421e600c75ab87f7c (patch)
tree8f0e359445e324e4694e79526e443d5e6c90fab4 /indra/llcorehttp/_httpservice.h
parent8fc350125c671baeae6b7f8b1814251009f4f50a (diff)
Major steps towards implementing the policy component.
Identified and reacted to the priority inversion problem we have in texturefetch. Includes the introduction of a priority_queue for the requests that are ready. Start some parameterization in anticipation of having policy_class everywhere. Removed _assert.h which isn't really needed in indra codebase. Implemented async setPriority request (which I hope I can get rid of eventually along with all priorities in this library). Converted to using unsigned int for priority rather than float. Implemented POST and did groundwork for PUT.
Diffstat (limited to 'indra/llcorehttp/_httpservice.h')
-rw-r--r--indra/llcorehttp/_httpservice.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/indra/llcorehttp/_httpservice.h b/indra/llcorehttp/_httpservice.h
index ba76e1eeca..3e5a5457d7 100644
--- a/indra/llcorehttp/_httpservice.h
+++ b/indra/llcorehttp/_httpservice.h
@@ -28,6 +28,9 @@
#define _LLCORE_HTTP_SERVICE_H_
+#include "httpcommon.h"
+
+
namespace LLCoreInt
{
@@ -86,7 +89,17 @@ public:
RUNNING, ///< thread created and running
STOPPED ///< thread has committed to exiting
};
-
+
+ // Ordered enumeration of idling strategies available to
+ // threadRun's loop. Ordered so that std::min on values
+ // produces the most conservative result of multiple
+ // requests.
+ enum ELoopSpeed
+ {
+ NORMAL, ///< continuous polling of request, ready, active queues
+ REQUEST_SLEEP ///< can sleep indefinitely waiting for request queue write
+ };
+
static void init(HttpRequestQueue *);
static void term();
@@ -124,6 +137,15 @@ public:
/// Threading: callable by worker thread.
void shutdown();
+
+ /// Try to find the given request handle on any of the request
+ /// queues and reset the priority (and queue position) of the
+ /// request if found.
+ ///
+ /// @return True if the request was found somewhere.
+ ///
+ /// Threading: callable by worker thread.
+ bool changePriority(HttpHandle handle, unsigned int priority);
HttpPolicy * getPolicy()
{
@@ -138,7 +160,7 @@ public:
protected:
void threadRun(LLCoreInt::HttpThread * thread);
- void processRequestQueue();
+ ELoopSpeed processRequestQueue(ELoopSpeed loop);
protected:
static HttpService * sInstance;