diff options
author | Rider Linden <none@none> | 2015-04-08 10:17:34 -0700 |
---|---|---|
committer | Rider Linden <none@none> | 2015-04-08 10:17:34 -0700 |
commit | 1c91c8a106a78f2087a3fb4312e428a0128283b4 (patch) | |
tree | 1f80ff372a3a9c2670049f76cde4d6782661dfe9 /indra/llmessage/llcorehttputil.h | |
parent | fe34b3ef725b83af0deeffcf8bf6ef9769224e8d (diff) |
Adding weak pointer support.
Event polling as a coroutine. (incomplete)
Groundwork for canceling HttpCoroutineAdapter yields.
Diffstat (limited to 'indra/llmessage/llcorehttputil.h')
-rw-r--r-- | indra/llmessage/llcorehttputil.h | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/indra/llmessage/llcorehttputil.h b/indra/llmessage/llcorehttputil.h index 10f46dd477..33cc389c49 100644 --- a/indra/llmessage/llcorehttputil.h +++ b/indra/llmessage/llcorehttputil.h @@ -210,36 +210,54 @@ private: class HttpCoroutineAdapter { public: + typedef boost::shared_ptr<HttpCoroutineAdapter> ptr_t; + typedef boost::weak_ptr<HttpCoroutineAdapter> wptr_t; + HttpCoroutineAdapter(const std::string &name, LLCore::HttpRequest::policy_t policyId, LLCore::HttpRequest::priority_t priority = 0L); ~HttpCoroutineAdapter(); /// Execute a Post transaction on the supplied URL and yield execution of - /// the coroutine until a result is available. - LLSD postAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t & request, + /// the coroutine until a result is available. + /// Note: the request's smart pointer is passed by value so that it will + /// not be deallocated during the yield. + LLSD postAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t()); + LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions(), false), + LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders(), false)); /// Execute a Put transaction on the supplied URL and yield execution of /// the coroutine until a result is available. - LLSD putAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t & request, + /// Note: the request's smart pointer is passed by value so that it will + /// not be deallocated during the yield. + LLSD putAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t()); /// Execute a Get transaction on the supplied URL and yield execution of /// the coroutine until a result is available. - LLSD getAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t & request, + /// Note: the request's smart pointer is passed by value so that it will + /// not be deallocated during the yield. + LLSD getAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t()); + /// + void cancelYieldingOperation(); + private: + static LLSD buildImmediateErrorResult(const LLCore::HttpRequest::ptr_t &request, + const std::string &url, LLCoreHttpUtil::HttpCoroHandler::ptr_t &httpHandler); std::string mAdapterName; LLCore::HttpRequest::priority_t mPriority; LLCore::HttpRequest::policy_t mPolicyId; + + LLCore::HttpHandle mYieldingHandle; + LLCore::HttpRequest::wptr_t mWeakRequest; + }; } // end namespace LLCoreHttpUtil |