diff options
author | Rider Linden <none@none> | 2015-04-03 14:23:31 -0700 |
---|---|---|
committer | Rider Linden <none@none> | 2015-04-03 14:23:31 -0700 |
commit | 17641c8427d05c4cde1fadd2ca059264d89bc818 (patch) | |
tree | 08f12a5bc407e770a99bc69a78807bf1d2bc4d5a /indra/llmessage | |
parent | fbd58959c2ac2216fb451bd687558763ceb2ab30 (diff) |
Added a class to automate pumping the HttpRequest on the mainloop.
Converted AccountingCostManager to use the new LLCore::Http library and coroutines.
Diffstat (limited to 'indra/llmessage')
-rwxr-xr-x | indra/llmessage/llavatarnamecache.h | 2 | ||||
-rw-r--r-- | indra/llmessage/llcorehttputil.cpp | 21 | ||||
-rw-r--r-- | indra/llmessage/llcorehttputil.h | 18 |
3 files changed, 37 insertions, 4 deletions
diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h index fdfd4e972d..17b948f799 100755 --- a/indra/llmessage/llavatarnamecache.h +++ b/indra/llmessage/llavatarnamecache.h @@ -29,8 +29,6 @@ #define LLAVATARNAMECACHE_H #include "llavatarname.h" // for convenience -//#include "httpcommon.h" -//#include "httpheaders.h" #include <boost/signals2.hpp> class LLSD; 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 diff --git a/indra/llmessage/llcorehttputil.h b/indra/llmessage/llcorehttputil.h index 0bc102a0a3..4ae6e112b3 100644 --- a/indra/llmessage/llcorehttputil.h +++ b/indra/llmessage/llcorehttputil.h @@ -165,8 +165,6 @@ LLCore::HttpHandle requestPutWithLLSD(LLCore::HttpRequest::ptr_t & request, /// +- ["url"] - The URL used to make the call. /// +- ["headers"] - A map of name name value pairs with the HTTP headers. /// - -/// class HttpCoroHandler : public LLCore::HttpHandler { public: @@ -182,6 +180,22 @@ private: LLEventStream &mReplyPump; }; +/// The HttpRequestPumper is a utility class. When constructed it will poll the +/// supplied HttpRequest once per frame until it is destroyed. +/// +class HttpRequestPumper +{ +public: + HttpRequestPumper(const LLCore::HttpRequest::ptr_t &request); + ~HttpRequestPumper(); + +private: + bool pollRequest(const LLSD&); + + LLTempBoundListener mBoundListener; + LLCore::HttpRequest::ptr_t mHttpRequest; +}; + } // end namespace LLCoreHttpUtil |