summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/_httplibcurl.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/_httplibcurl.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/_httplibcurl.h')
-rw-r--r--indra/llcorehttp/_httplibcurl.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/indra/llcorehttp/_httplibcurl.h b/indra/llcorehttp/_httplibcurl.h
index 807196628d..ec325c1946 100644
--- a/indra/llcorehttp/_httplibcurl.h
+++ b/indra/llcorehttp/_httplibcurl.h
@@ -34,18 +34,25 @@
#include <set>
+#include "httprequest.h"
+#include "_httpservice.h"
+
namespace LLCore
{
-class HttpService;
class HttpPolicy;
class HttpOpRequest;
class HttpHeaders;
/// Implements libcurl-based transport for an HttpService instance.
+///
+/// Threading: Single-threaded. Other than for construction/destruction,
+/// all methods are expected to be invoked in a single thread, typically
+/// a worker thread of some sort.
+
class HttpLibcurl
{
public:
@@ -60,12 +67,22 @@ public:
static void init();
static void term();
- void processTransport();
- void addOp(HttpOpRequest * op);
+ /// Give cycles to libcurl to run active requests. Completed
+ /// operations (successful or failed) will be retried or handed
+ /// over to the reply queue as final responses.
+ HttpService::ELoopSpeed processTransport();
- int activeCount() const;
+ /// Add request to the active list. Caller is expected to have
+ /// provided us with a reference count to hold the request. (No
+ /// additional references will be added.)
+ void addOp(HttpOpRequest * op);
+ int getActiveCount() const;
+ int getActiveCountInClass(int policy_class) const;
+
protected:
+ /// Invoked when libcurl has indicated a request has been processed
+ /// to completion and we need to move the request to a new state.
void completeRequest(CURLM * multi_handle, CURL * handle, CURLcode status);
protected:
@@ -74,7 +91,7 @@ protected:
protected:
HttpService * mService; // Simple reference, not owner
active_set_t mActiveOps;
- CURLM * mMultiHandles[1];
+ CURLM * mMultiHandles[HttpRequest::POLICY_CLASS_LIMIT];
}; // end class HttpLibcurl