From 17641c8427d05c4cde1fadd2ca059264d89bc818 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 3 Apr 2015 14:23:31 -0700 Subject: Added a class to automate pumping the HttpRequest on the mainloop. Converted AccountingCostManager to use the new LLCore::Http library and coroutines. --- indra/llmessage/llcorehttputil.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'indra/llmessage/llcorehttputil.cpp') diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index 991985b1cf..30f5f3d3ed 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -279,6 +279,27 @@ void HttpCoroHandler::buildStatusEntry(LLCore::HttpResponse *response, LLCore::H result["http_result"] = httpresults; } +HttpRequestPumper::HttpRequestPumper(const LLCore::HttpRequest::ptr_t &request): + mHttpRequest(request) +{ + mBoundListener = LLEventPumps::instance().obtain("mainloop"). + listen(LLEventPump::inventName(), boost::bind(&HttpRequestPumper::pollRequest, this, _1)); +} + +HttpRequestPumper::~HttpRequestPumper() +{ + if (mBoundListener.connected()) + { + mBoundListener.disconnect(); + } +} + +bool HttpRequestPumper::pollRequest(const LLSD&) +{ + mHttpRequest->update(0L); + return false; +} + } // end namespace LLCoreHttpUtil -- cgit v1.2.3