diff --git a/indra/llcorehttp/_httpoperation.h b/indra/llcorehttp/_httpoperation.h index 6c0c3183b74de0a6bfe6cf84677cfc94dec02df9..4d9298d8010ff100dc3d3c72a4337d8e21583475 100644 --- a/indra/llcorehttp/_httpoperation.h +++ b/indra/llcorehttp/_httpoperation.h @@ -29,7 +29,7 @@ #include "httpcommon.h" - +#include "httprequest.h" #include "_refcounted.h" @@ -39,7 +39,6 @@ namespace LLCore class HttpReplyQueue; class HttpHandler; class HttpService; -class HttpRequest; /// HttpOperation is the base class for all request/reply /// pairs. @@ -102,13 +101,13 @@ class HttpOperation : public LLCoreInt::RefCounted void addAsReply(); protected: - HttpReplyQueue * mReplyQueue; // Have refcount - HttpHandler * mLibraryHandler; // Have refcount - HttpHandler * mUserHandler; // Have refcount + HttpReplyQueue * mReplyQueue; // Have refcount + HttpHandler * mLibraryHandler; // Have refcount + HttpHandler * mUserHandler; // Have refcount public: - unsigned int mReqPolicy; - unsigned int mReqPriority; + HttpRequest::policy_t mReqPolicy; + HttpRequest::priority_t mReqPriority; }; // end class HttpOperation diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index 54b9990057de9e559078fb8ab04ba48da6418a6b..791ee5f860040f4fed7943973c27bbd8f773bae9 100644 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -233,8 +233,8 @@ HttpStatus HttpOpRequest::cancel() } -HttpStatus HttpOpRequest::setupGetByteRange(unsigned int policy_id, - float priority, +HttpStatus HttpOpRequest::setupGetByteRange(HttpRequest::policy_t policy_id, + HttpRequest::priority_t priority, const std::string & url, size_t offset, size_t len, @@ -268,8 +268,8 @@ HttpStatus HttpOpRequest::setupGetByteRange(unsigned int policy_id, } -HttpStatus HttpOpRequest::setupPost(unsigned int policy_id, - float priority, +HttpStatus HttpOpRequest::setupPost(HttpRequest::policy_t policy_id, + HttpRequest::priority_t priority, const std::string & url, BufferArray * body, HttpOptions * options, diff --git a/indra/llcorehttp/_httpoprequest.h b/indra/llcorehttp/_httpoprequest.h index 7efed0b1d96f3efb9974d552c1687fe764fe6dd5..e973f6ad26a9349eb8548197cd513ac722a73c25 100644 --- a/indra/llcorehttp/_httpoprequest.h +++ b/indra/llcorehttp/_httpoprequest.h @@ -30,10 +30,10 @@ #include "linden_common.h" // Modifies curl/curl.h interfaces -#include "httpcommon.h" - #include <curl/curl.h> +#include "httpcommon.h" +#include "httprequest.h" #include "_httpoperation.h" #include "_refcounted.h" @@ -76,16 +76,16 @@ class HttpOpRequest : public HttpOperation public: // Setup Methods - HttpStatus setupGetByteRange(unsigned int policy_id, - float priority, + HttpStatus setupGetByteRange(HttpRequest::policy_t policy_id, + HttpRequest::priority_t priority, const std::string & url, size_t offset, size_t len, HttpOptions * options, HttpHeaders * headers); - HttpStatus setupPost(unsigned int policy_id, - float priority, + HttpStatus setupPost(HttpRequest::policy_t policy_id, + HttpRequest::priority_t priority, const std::string & url, BufferArray * body, HttpOptions * options, diff --git a/indra/llcorehttp/_httpopsetpriority.cpp b/indra/llcorehttp/_httpopsetpriority.cpp index dc609421edf6c45c14a16e06c7879cb9b2093bf9..b0ee577087b1c6d90dd3de73754caecf3329fd12 100644 --- a/indra/llcorehttp/_httpopsetpriority.cpp +++ b/indra/llcorehttp/_httpopsetpriority.cpp @@ -35,7 +35,7 @@ namespace LLCore { -HttpOpSetPriority::HttpOpSetPriority(HttpHandle handle, unsigned int priority) +HttpOpSetPriority::HttpOpSetPriority(HttpHandle handle, HttpRequest::priority_t priority) : HttpOperation(), mHandle(handle), mPriority(priority) diff --git a/indra/llcorehttp/_httpopsetpriority.h b/indra/llcorehttp/_httpopsetpriority.h index e5d8e5fc1f2ab0347ec43b61dcc255d7bb70d8c2..b972f50fff0a8042d27f5af8bcb33aca315c9d76 100644 --- a/indra/llcorehttp/_httpopsetpriority.h +++ b/indra/llcorehttp/_httpopsetpriority.h @@ -29,7 +29,7 @@ #include "httpcommon.h" - +#include "httprequest.h" #include "_httpoperation.h" #include "_refcounted.h" @@ -46,7 +46,7 @@ namespace LLCore class HttpOpSetPriority : public HttpOperation { public: - HttpOpSetPriority(HttpHandle handle, unsigned int priority); + HttpOpSetPriority(HttpHandle handle, HttpRequest::priority_t priority); virtual ~HttpOpSetPriority(); private: @@ -59,9 +59,9 @@ class HttpOpSetPriority : public HttpOperation virtual void visitNotifier(HttpRequest * request); protected: - HttpStatus mStatus; - HttpHandle mHandle; - unsigned int mPriority; + HttpStatus mStatus; + HttpHandle mHandle; + HttpRequest::priority_t mPriority; }; // end class HttpOpSetPriority } // end namespace LLCore diff --git a/indra/llcorehttp/_httppolicy.cpp b/indra/llcorehttp/_httppolicy.cpp index 873b519c51a3741ef07e9b48d75f139412e2928a..1d28f23d5633e3209dd009ddcaac44aad60c58ad 100644 --- a/indra/llcorehttp/_httppolicy.cpp +++ b/indra/llcorehttp/_httppolicy.cpp @@ -112,7 +112,7 @@ HttpService::ELoopSpeed HttpPolicy::processReadyQueue() } -bool HttpPolicy::changePriority(HttpHandle handle, unsigned int priority) +bool HttpPolicy::changePriority(HttpHandle handle, HttpRequest::priority_t priority) { for (int policy_class(0); policy_class < HttpRequest::POLICY_CLASS_LIMIT; ++policy_class) { diff --git a/indra/llcorehttp/_httppolicy.h b/indra/llcorehttp/_httppolicy.h index c5e82d0a658d0b298367926acca7f14ccaa8fa4f..2bc03c531fb7588a9770888ac76d69baf77d9571 100644 --- a/indra/llcorehttp/_httppolicy.h +++ b/indra/llcorehttp/_httppolicy.h @@ -67,7 +67,7 @@ class HttpPolicy void addOp(HttpOpRequest *); // Shadows HttpService's method - bool changePriority(HttpHandle handle, unsigned int priority); + bool changePriority(HttpHandle handle, HttpRequest::priority_t priority); protected: int mReadyInClass[HttpRequest::POLICY_CLASS_LIMIT]; diff --git a/indra/llcorehttp/_httpservice.cpp b/indra/llcorehttp/_httpservice.cpp index 48884ca0602ea80b056a97d3cfce3095f2ace0fc..337493ca12b6fc2b57cf23174737c7ef6eca8d45 100644 --- a/indra/llcorehttp/_httpservice.cpp +++ b/indra/llcorehttp/_httpservice.cpp @@ -152,7 +152,7 @@ void HttpService::stopRequested() mExitRequested = true; } -bool HttpService::changePriority(HttpHandle handle, unsigned int priority) +bool HttpService::changePriority(HttpHandle handle, HttpRequest::priority_t priority) { bool found(false); diff --git a/indra/llcorehttp/_httpservice.h b/indra/llcorehttp/_httpservice.h index 3e5a5457d7dd0864b4d4298f22e52e38342d7a6c..095316c8a771aca80a035ee55013eaf9c13b8d16 100644 --- a/indra/llcorehttp/_httpservice.h +++ b/indra/llcorehttp/_httpservice.h @@ -29,6 +29,7 @@ #include "httpcommon.h" +#include "httprequest.h" namespace LLCoreInt @@ -145,7 +146,7 @@ class HttpService /// @return True if the request was found somewhere. /// /// Threading: callable by worker thread. - bool changePriority(HttpHandle handle, unsigned int priority); + bool changePriority(HttpHandle handle, HttpRequest::priority_t priority); HttpPolicy * getPolicy() { diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp index a06b859a912060662c2d8a7205e2c64c54a439ff..0e512d97ed5444f748011feea2071597e79dc528 100644 --- a/indra/llcorehttp/httprequest.cpp +++ b/indra/llcorehttp/httprequest.cpp @@ -83,7 +83,7 @@ class HttpRequest::InternalHandler : public HttpHandler // ==================================== -unsigned int HttpRequest::sNextPolicyID(1); +HttpRequest::policy_t HttpRequest::sNextPolicyID(1); HttpRequest::HttpRequest() @@ -133,15 +133,15 @@ HttpStatus HttpRequest::setPolicyGlobalOption(EGlobalPolicy opt, long value) } -unsigned int HttpRequest::createPolicyClass() +HttpRequest::policy_t HttpRequest::createPolicyClass() { - unsigned int policy_id = 1; + policy_t policy_id = 1; return policy_id; } -HttpStatus HttpRequest::setPolicyClassOption(unsigned int policy_id, +HttpStatus HttpRequest::setPolicyClassOption(policy_t policy_id, EClassPolicy opt, long value) { @@ -162,8 +162,8 @@ HttpStatus HttpRequest::getStatus() const } -HttpHandle HttpRequest::requestGetByteRange(unsigned int policy_id, - unsigned int priority, +HttpHandle HttpRequest::requestGetByteRange(policy_t policy_id, + priority_t priority, const std::string & url, size_t offset, size_t len, @@ -191,8 +191,8 @@ HttpHandle HttpRequest::requestGetByteRange(unsigned int policy_id, } -HttpHandle HttpRequest::requestPost(unsigned int policy_id, - unsigned int priority, +HttpHandle HttpRequest::requestPost(policy_t policy_id, + priority_t priority, const std::string & url, BufferArray * body, HttpOptions * options, @@ -251,7 +251,7 @@ HttpHandle HttpRequest::requestNoOp(HttpHandler * user_handler) } -HttpHandle HttpRequest::requestSetPriority(HttpHandle request, unsigned int priority, +HttpHandle HttpRequest::requestSetPriority(HttpHandle request, priority_t priority, HttpHandler * handler) { HttpStatus status; diff --git a/indra/llcorehttp/httprequest.h b/indra/llcorehttp/httprequest.h index e2ab9be533415b45e3f4289c7d74fef23b70de57..57d2da245b6bcb25f2c63b5628fc8366cff276bc 100644 --- a/indra/llcorehttp/httprequest.h +++ b/indra/llcorehttp/httprequest.h @@ -90,6 +90,10 @@ class HttpRequest HttpRequest(const HttpRequest &); // Disallowed void operator=(const HttpRequest &); // Disallowed +public: + typedef unsigned int policy_t; + typedef unsigned int priority_t; + public: /// @name PolicyMethods /// @{ @@ -125,7 +129,7 @@ class HttpRequest /// the class in other methods. If -1, an error /// occurred and @see getStatus() may provide more /// detail on the reason. - unsigned int createPolicyClass(); + policy_t createPolicyClass(); enum EClassPolicy { @@ -149,7 +153,7 @@ class HttpRequest /// @param opt Enum of option to be set. /// @param value Desired value of option. /// @return Standard status code. - HttpStatus setPolicyClassOption(unsigned int policy_id, + HttpStatus setPolicyClassOption(policy_t policy_id, EClassPolicy opt, long value); @@ -194,8 +198,8 @@ class HttpRequest /// request could not be queued. In the latter /// case, @see getStatus() will return more info. /// - HttpHandle requestGetByteRange(unsigned int policy_id, - unsigned int priority, + HttpHandle requestGetByteRange(policy_t policy_id, + priority_t priority, const std::string & url, size_t offset, size_t len, @@ -221,8 +225,8 @@ class HttpRequest /// request could not be queued. In the latter /// case, @see getStatus() will return more info. /// - HttpHandle requestPost(unsigned int policy_id, - unsigned int priority, + HttpHandle requestPost(policy_t policy_id, + priority_t priority, const std::string & url, BufferArray * body, HttpOptions * options, @@ -278,7 +282,7 @@ class HttpRequest /// queued or LLCORE_HTTP_HANDLE_INVALID if the /// request could not be queued. /// - HttpHandle requestSetPriority(HttpHandle request, unsigned int priority, HttpHandler * handler); + HttpHandle requestSetPriority(HttpHandle request, priority_t priority, HttpHandler * handler); /// @} @@ -345,7 +349,7 @@ class HttpRequest /// Must be established before any threading is allowed to /// start. /// - static unsigned int sNextPolicyID; + static policy_t sNextPolicyID; /// @} // End Global State