Skip to content
Snippets Groups Projects
Commit 7b9da4ee authored by Monty Brandenberg's avatar Monty Brandenberg
Browse files

Missed two instances of priority typed as 'float'. Became an

excuse to go through an use a typedef for priority and policy class id.
parent f6708433
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "httpcommon.h" #include "httpcommon.h"
#include "httprequest.h"
#include "_refcounted.h" #include "_refcounted.h"
...@@ -39,7 +39,6 @@ namespace LLCore ...@@ -39,7 +39,6 @@ namespace LLCore
class HttpReplyQueue; class HttpReplyQueue;
class HttpHandler; class HttpHandler;
class HttpService; class HttpService;
class HttpRequest;
/// HttpOperation is the base class for all request/reply /// HttpOperation is the base class for all request/reply
/// pairs. /// pairs.
...@@ -102,13 +101,13 @@ class HttpOperation : public LLCoreInt::RefCounted ...@@ -102,13 +101,13 @@ class HttpOperation : public LLCoreInt::RefCounted
void addAsReply(); void addAsReply();
protected: protected:
HttpReplyQueue * mReplyQueue; // Have refcount HttpReplyQueue * mReplyQueue; // Have refcount
HttpHandler * mLibraryHandler; // Have refcount HttpHandler * mLibraryHandler; // Have refcount
HttpHandler * mUserHandler; // Have refcount HttpHandler * mUserHandler; // Have refcount
public: public:
unsigned int mReqPolicy; HttpRequest::policy_t mReqPolicy;
unsigned int mReqPriority; HttpRequest::priority_t mReqPriority;
}; // end class HttpOperation }; // end class HttpOperation
......
...@@ -233,8 +233,8 @@ HttpStatus HttpOpRequest::cancel() ...@@ -233,8 +233,8 @@ HttpStatus HttpOpRequest::cancel()
} }
HttpStatus HttpOpRequest::setupGetByteRange(unsigned int policy_id, HttpStatus HttpOpRequest::setupGetByteRange(HttpRequest::policy_t policy_id,
float priority, HttpRequest::priority_t priority,
const std::string & url, const std::string & url,
size_t offset, size_t offset,
size_t len, size_t len,
...@@ -268,8 +268,8 @@ HttpStatus HttpOpRequest::setupGetByteRange(unsigned int policy_id, ...@@ -268,8 +268,8 @@ HttpStatus HttpOpRequest::setupGetByteRange(unsigned int policy_id,
} }
HttpStatus HttpOpRequest::setupPost(unsigned int policy_id, HttpStatus HttpOpRequest::setupPost(HttpRequest::policy_t policy_id,
float priority, HttpRequest::priority_t priority,
const std::string & url, const std::string & url,
BufferArray * body, BufferArray * body,
HttpOptions * options, HttpOptions * options,
......
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
#include "linden_common.h" // Modifies curl/curl.h interfaces #include "linden_common.h" // Modifies curl/curl.h interfaces
#include "httpcommon.h"
#include <curl/curl.h> #include <curl/curl.h>
#include "httpcommon.h"
#include "httprequest.h"
#include "_httpoperation.h" #include "_httpoperation.h"
#include "_refcounted.h" #include "_refcounted.h"
...@@ -76,16 +76,16 @@ class HttpOpRequest : public HttpOperation ...@@ -76,16 +76,16 @@ class HttpOpRequest : public HttpOperation
public: public:
// Setup Methods // Setup Methods
HttpStatus setupGetByteRange(unsigned int policy_id, HttpStatus setupGetByteRange(HttpRequest::policy_t policy_id,
float priority, HttpRequest::priority_t priority,
const std::string & url, const std::string & url,
size_t offset, size_t offset,
size_t len, size_t len,
HttpOptions * options, HttpOptions * options,
HttpHeaders * headers); HttpHeaders * headers);
HttpStatus setupPost(unsigned int policy_id, HttpStatus setupPost(HttpRequest::policy_t policy_id,
float priority, HttpRequest::priority_t priority,
const std::string & url, const std::string & url,
BufferArray * body, BufferArray * body,
HttpOptions * options, HttpOptions * options,
......
...@@ -35,7 +35,7 @@ namespace LLCore ...@@ -35,7 +35,7 @@ namespace LLCore
{ {
HttpOpSetPriority::HttpOpSetPriority(HttpHandle handle, unsigned int priority) HttpOpSetPriority::HttpOpSetPriority(HttpHandle handle, HttpRequest::priority_t priority)
: HttpOperation(), : HttpOperation(),
mHandle(handle), mHandle(handle),
mPriority(priority) mPriority(priority)
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "httpcommon.h" #include "httpcommon.h"
#include "httprequest.h"
#include "_httpoperation.h" #include "_httpoperation.h"
#include "_refcounted.h" #include "_refcounted.h"
...@@ -46,7 +46,7 @@ namespace LLCore ...@@ -46,7 +46,7 @@ namespace LLCore
class HttpOpSetPriority : public HttpOperation class HttpOpSetPriority : public HttpOperation
{ {
public: public:
HttpOpSetPriority(HttpHandle handle, unsigned int priority); HttpOpSetPriority(HttpHandle handle, HttpRequest::priority_t priority);
virtual ~HttpOpSetPriority(); virtual ~HttpOpSetPriority();
private: private:
...@@ -59,9 +59,9 @@ class HttpOpSetPriority : public HttpOperation ...@@ -59,9 +59,9 @@ class HttpOpSetPriority : public HttpOperation
virtual void visitNotifier(HttpRequest * request); virtual void visitNotifier(HttpRequest * request);
protected: protected:
HttpStatus mStatus; HttpStatus mStatus;
HttpHandle mHandle; HttpHandle mHandle;
unsigned int mPriority; HttpRequest::priority_t mPriority;
}; // end class HttpOpSetPriority }; // end class HttpOpSetPriority
} // end namespace LLCore } // end namespace LLCore
......
...@@ -112,7 +112,7 @@ HttpService::ELoopSpeed HttpPolicy::processReadyQueue() ...@@ -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) for (int policy_class(0); policy_class < HttpRequest::POLICY_CLASS_LIMIT; ++policy_class)
{ {
......
...@@ -67,7 +67,7 @@ class HttpPolicy ...@@ -67,7 +67,7 @@ class HttpPolicy
void addOp(HttpOpRequest *); void addOp(HttpOpRequest *);
// Shadows HttpService's method // Shadows HttpService's method
bool changePriority(HttpHandle handle, unsigned int priority); bool changePriority(HttpHandle handle, HttpRequest::priority_t priority);
protected: protected:
int mReadyInClass[HttpRequest::POLICY_CLASS_LIMIT]; int mReadyInClass[HttpRequest::POLICY_CLASS_LIMIT];
......
...@@ -152,7 +152,7 @@ void HttpService::stopRequested() ...@@ -152,7 +152,7 @@ void HttpService::stopRequested()
mExitRequested = true; mExitRequested = true;
} }
bool HttpService::changePriority(HttpHandle handle, unsigned int priority) bool HttpService::changePriority(HttpHandle handle, HttpRequest::priority_t priority)
{ {
bool found(false); bool found(false);
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "httpcommon.h" #include "httpcommon.h"
#include "httprequest.h"
namespace LLCoreInt namespace LLCoreInt
...@@ -145,7 +146,7 @@ class HttpService ...@@ -145,7 +146,7 @@ class HttpService
/// @return True if the request was found somewhere. /// @return True if the request was found somewhere.
/// ///
/// Threading: callable by worker thread. /// Threading: callable by worker thread.
bool changePriority(HttpHandle handle, unsigned int priority); bool changePriority(HttpHandle handle, HttpRequest::priority_t priority);
HttpPolicy * getPolicy() HttpPolicy * getPolicy()
{ {
......
...@@ -83,7 +83,7 @@ class HttpRequest::InternalHandler : public HttpHandler ...@@ -83,7 +83,7 @@ class HttpRequest::InternalHandler : public HttpHandler
// ==================================== // ====================================
unsigned int HttpRequest::sNextPolicyID(1); HttpRequest::policy_t HttpRequest::sNextPolicyID(1);
HttpRequest::HttpRequest() HttpRequest::HttpRequest()
...@@ -133,15 +133,15 @@ HttpStatus HttpRequest::setPolicyGlobalOption(EGlobalPolicy opt, long value) ...@@ -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; return policy_id;
} }
HttpStatus HttpRequest::setPolicyClassOption(unsigned int policy_id, HttpStatus HttpRequest::setPolicyClassOption(policy_t policy_id,
EClassPolicy opt, EClassPolicy opt,
long value) long value)
{ {
...@@ -162,8 +162,8 @@ HttpStatus HttpRequest::getStatus() const ...@@ -162,8 +162,8 @@ HttpStatus HttpRequest::getStatus() const
} }
HttpHandle HttpRequest::requestGetByteRange(unsigned int policy_id, HttpHandle HttpRequest::requestGetByteRange(policy_t policy_id,
unsigned int priority, priority_t priority,
const std::string & url, const std::string & url,
size_t offset, size_t offset,
size_t len, size_t len,
...@@ -191,8 +191,8 @@ HttpHandle HttpRequest::requestGetByteRange(unsigned int policy_id, ...@@ -191,8 +191,8 @@ HttpHandle HttpRequest::requestGetByteRange(unsigned int policy_id,
} }
HttpHandle HttpRequest::requestPost(unsigned int policy_id, HttpHandle HttpRequest::requestPost(policy_t policy_id,
unsigned int priority, priority_t priority,
const std::string & url, const std::string & url,
BufferArray * body, BufferArray * body,
HttpOptions * options, HttpOptions * options,
...@@ -251,7 +251,7 @@ HttpHandle HttpRequest::requestNoOp(HttpHandler * user_handler) ...@@ -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) HttpHandler * handler)
{ {
HttpStatus status; HttpStatus status;
......
...@@ -90,6 +90,10 @@ class HttpRequest ...@@ -90,6 +90,10 @@ class HttpRequest
HttpRequest(const HttpRequest &); // Disallowed HttpRequest(const HttpRequest &); // Disallowed
void operator=(const HttpRequest &); // Disallowed void operator=(const HttpRequest &); // Disallowed
public:
typedef unsigned int policy_t;
typedef unsigned int priority_t;
public: public:
/// @name PolicyMethods /// @name PolicyMethods
/// @{ /// @{
...@@ -125,7 +129,7 @@ class HttpRequest ...@@ -125,7 +129,7 @@ class HttpRequest
/// the class in other methods. If -1, an error /// the class in other methods. If -1, an error
/// occurred and @see getStatus() may provide more /// occurred and @see getStatus() may provide more
/// detail on the reason. /// detail on the reason.
unsigned int createPolicyClass(); policy_t createPolicyClass();
enum EClassPolicy enum EClassPolicy
{ {
...@@ -149,7 +153,7 @@ class HttpRequest ...@@ -149,7 +153,7 @@ class HttpRequest
/// @param opt Enum of option to be set. /// @param opt Enum of option to be set.
/// @param value Desired value of option. /// @param value Desired value of option.
/// @return Standard status code. /// @return Standard status code.
HttpStatus setPolicyClassOption(unsigned int policy_id, HttpStatus setPolicyClassOption(policy_t policy_id,
EClassPolicy opt, EClassPolicy opt,
long value); long value);
...@@ -194,8 +198,8 @@ class HttpRequest ...@@ -194,8 +198,8 @@ class HttpRequest
/// request could not be queued. In the latter /// request could not be queued. In the latter
/// case, @see getStatus() will return more info. /// case, @see getStatus() will return more info.
/// ///
HttpHandle requestGetByteRange(unsigned int policy_id, HttpHandle requestGetByteRange(policy_t policy_id,
unsigned int priority, priority_t priority,
const std::string & url, const std::string & url,
size_t offset, size_t offset,
size_t len, size_t len,
...@@ -221,8 +225,8 @@ class HttpRequest ...@@ -221,8 +225,8 @@ class HttpRequest
/// request could not be queued. In the latter /// request could not be queued. In the latter
/// case, @see getStatus() will return more info. /// case, @see getStatus() will return more info.
/// ///
HttpHandle requestPost(unsigned int policy_id, HttpHandle requestPost(policy_t policy_id,
unsigned int priority, priority_t priority,
const std::string & url, const std::string & url,
BufferArray * body, BufferArray * body,
HttpOptions * options, HttpOptions * options,
...@@ -278,7 +282,7 @@ class HttpRequest ...@@ -278,7 +282,7 @@ class HttpRequest
/// queued or LLCORE_HTTP_HANDLE_INVALID if the /// queued or LLCORE_HTTP_HANDLE_INVALID if the
/// request could not be queued. /// 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 ...@@ -345,7 +349,7 @@ class HttpRequest
/// Must be established before any threading is allowed to /// Must be established before any threading is allowed to
/// start. /// start.
/// ///
static unsigned int sNextPolicyID; static policy_t sNextPolicyID;
/// @} /// @}
// End Global State // End Global State
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment