Let statemachine honor approvements.
The inventory bulk fetch is not thread-safe, so the it doesn't start right away, causing the approvement not to be honored upon return from post_approved (formerly post_nb). This patch renames wantsMoreHTTPReqestsFor to approveHTTPRequestFor, and has it return NULL or a AIPerService::Approvement object. The latter is now passed to the CurlEasyHandle object instead of just a boolean mQueueIfTooMuchBandwidthUsage, and then the Approvement is honored by the state machine right after the request is actually added to the command queue. This should avoid a flood of inventory requests in the case approveHTTPRequestFor is called multiple times before the main thread adds the requests to the command queue. I don't think that actually ever happens, but I added debug code (to find some problem) that is so damn strictly checking everything that I need to be this precise in order to do that testing.
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "llassettype.h"
|
||||
#include "llhttpstatuscodes.h"
|
||||
#include "aihttpheaders.h"
|
||||
#include "aicurlperservice.h"
|
||||
|
||||
class LLUUID;
|
||||
class LLPumpIO;
|
||||
@@ -426,15 +427,15 @@ public:
|
||||
ERequestAction method,
|
||||
Injector* body_injector,
|
||||
ResponderPtr responder,
|
||||
AIHTTPHeaders& headers/*,*/
|
||||
AIHTTPHeaders& headers,
|
||||
AIPerService::Approvement* approved/*,*/
|
||||
DEBUG_CURLIO_PARAM(EDebugCurl debug),
|
||||
EKeepAlive keepalive = keep_alive,
|
||||
EDoesAuthentication does_auth = no_does_authentication,
|
||||
EAllowCompressedReply allow_compression = allow_compressed_reply,
|
||||
AIStateMachine* parent = NULL,
|
||||
/*AIStateMachine::state_type*/ U32 new_parent_state = 0,
|
||||
AIEngine* default_engine = &gMainThreadEngine,
|
||||
bool queue_if_too_much_bandwidth_usage = true);
|
||||
AIEngine* default_engine = &gMainThreadEngine);
|
||||
|
||||
/** @name non-blocking API */
|
||||
//@{
|
||||
@@ -466,9 +467,9 @@ public:
|
||||
static void post(std::string const& url, LLSD const& body, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive, AIStateMachine* parent = NULL, U32 new_parent_state = 0)
|
||||
{ AIHTTPHeaders headers; post(url, body, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive, parent, new_parent_state); }
|
||||
|
||||
static void post_nb(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive, AIStateMachine* parent = NULL, U32 new_parent_state = 0);
|
||||
static void post_nb(std::string const& url, LLSD const& body, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive, AIStateMachine* parent = NULL, U32 new_parent_state = 0)
|
||||
{ AIHTTPHeaders headers; post_nb(url, body, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive, parent, new_parent_state); }
|
||||
static void post_approved(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers, AIPerService::Approvement* approved/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive, AIStateMachine* parent = NULL, U32 new_parent_state = 0);
|
||||
static void post_approved(std::string const& url, LLSD const& body, ResponderPtr responder, AIPerService::Approvement* approved/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive, AIStateMachine* parent = NULL, U32 new_parent_state = 0)
|
||||
{ AIHTTPHeaders headers; post_approved(url, body, responder, headers, approved/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive, parent, new_parent_state); }
|
||||
|
||||
/** Takes ownership of request and deletes it when sent */
|
||||
static void postXMLRPC(std::string const& url, XMLRPC_REQUEST request, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off), EKeepAlive keepalive = keep_alive);
|
||||
|
||||
Reference in New Issue
Block a user