diff options
author | Rider Linden <none@none> | 2015-04-28 09:39:47 -0700 |
---|---|---|
committer | Rider Linden <none@none> | 2015-04-28 09:39:47 -0700 |
commit | da32de179d50d85cd815c545282d274d18c9dc3e (patch) | |
tree | 624b8d45a5bbe31d314302f071fa5603b6cfd935 /indra/llmessage | |
parent | e5c281025d941996b94a27c28139d4aacbf68bce (diff) |
Converting llmediaclient to new order.
Temp disable llmediaclient's unit tests for link issues.
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/llhttpsdhandler.cpp | 16 | ||||
-rw-r--r-- | indra/llmessage/llhttpsdhandler.h | 15 |
2 files changed, 19 insertions, 12 deletions
diff --git a/indra/llmessage/llhttpsdhandler.cpp b/indra/llmessage/llhttpsdhandler.cpp index 159d03b176..d99bdd3f66 100644 --- a/indra/llmessage/llhttpsdhandler.cpp +++ b/indra/llmessage/llhttpsdhandler.cpp @@ -36,7 +36,8 @@ #include "llcorehttputil.h" //======================================================================== -LLHttpSDHandler::LLHttpSDHandler() +LLHttpSDHandler::LLHttpSDHandler(bool selfDelete): + mSelfDelete(selfDelete) { } @@ -77,26 +78,27 @@ void LLHttpSDHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespons // The handler must destroy itself when it is done. // *TODO: I'm not fond of this pattern. A class shooting itself in the head // outside of a smart pointer always makes me nervous. - delete this; + if (mSelfDelete) + delete this; } //======================================================================== -LLHttpSDGenericHandler::LLHttpSDGenericHandler(const std::string &caps) : - LLHttpSDHandler(), - mCaps(caps) +LLHttpSDGenericHandler::LLHttpSDGenericHandler(const std::string &name, bool selfDelete): + LLHttpSDHandler(selfDelete), + mName(name) { } void LLHttpSDGenericHandler::onSuccess(LLCore::HttpResponse * response, const LLSD &content) { - LL_DEBUGS() << mCaps << " Success." << LL_ENDL; + LL_DEBUGS() << mName << " Success." << LL_ENDL; } void LLHttpSDGenericHandler::onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status) { LL_WARNS() << "\n--------------------------------------------------------------------------\n" - << mCaps << " Error[" << status.toULong() << "] cannot access cap with url '" + << mName << " Error[" << status.toULong() << "] cannot access cap with url '" << response->getRequestURL() << "' because " << status.toString() << "\n--------------------------------------------------------------------------" << LL_ENDL; diff --git a/indra/llmessage/llhttpsdhandler.h b/indra/llmessage/llhttpsdhandler.h index 7c28dbcab6..814d1c22b5 100644 --- a/indra/llmessage/llhttpsdhandler.h +++ b/indra/llmessage/llhttpsdhandler.h @@ -36,32 +36,37 @@ /// // *TODO: This class self deletes at the end of onCompleted method. This is // less than ideal and should be revisited. -class LLHttpSDHandler : public LLCore::HttpHandler +class LLHttpSDHandler : public LLCore::HttpHandler //, +// public std::enable_shared_from_this<LLHttpSDHandler> { public: - LLHttpSDHandler(); virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response); protected: + LLHttpSDHandler(bool selfDelete = true); + virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content) = 0; virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status) = 0; +private: + bool mSelfDelete; + }; /// A trivial implementation of LLHttpSDHandler. This success and failure -/// methods log the action taken, the URI accessed and the status code retuned +/// methods log the action taken, the URI accessed and the status code returned /// in the response. class LLHttpSDGenericHandler : public LLHttpSDHandler { public: - LLHttpSDGenericHandler(const std::string &action); + LLHttpSDGenericHandler(const std::string &name, bool selfDelete = true); protected: virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content); virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status); private: - std::string mCaps; + std::string mName; }; #endif
\ No newline at end of file |