summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2015-05-08 16:15:27 -0700
committerRider Linden <rider@lindenlab.com>2015-05-08 16:15:27 -0700
commit6cba35d3c0a07843fe1254448fc122ecd3854424 (patch)
treef372b2cd7f7f3562275199b23ca4c4306a911f08
parent8d9282fca16d6118bc484b97fa905bcc616e0b9e (diff)
Updated llestateinfomodel
-rwxr-xr-xindra/newview/llestateinfomodel.cpp82
-rwxr-xr-xindra/newview/llestateinfomodel.h5
2 files changed, 49 insertions, 38 deletions
diff --git a/indra/newview/llestateinfomodel.cpp b/indra/newview/llestateinfomodel.cpp
index 78d619a315..152c17eb0f 100755
--- a/indra/newview/llestateinfomodel.cpp
+++ b/indra/newview/llestateinfomodel.cpp
@@ -38,6 +38,8 @@
#include "llfloaterregioninfo.h" // for invoice id
#include "llviewerregion.h"
+#include "llcorehttputil.h"
+
LLEstateInfoModel::LLEstateInfoModel()
: mID(0)
, mFlags(0)
@@ -110,24 +112,6 @@ void LLEstateInfoModel::notifyCommit()
//== PRIVATE STUFF ============================================================
-class LLEstateChangeInfoResponder : public LLHTTPClient::Responder
-{
- LOG_CLASS(LLEstateChangeInfoResponder);
-protected:
- // if we get a normal response, handle it here
- virtual void httpSuccesss()
- {
- LL_INFOS() << "Committed estate info" << LL_ENDL;
- LLEstateInfoModel::instance().notifyCommit();
- }
-
- // if we get an error response
- virtual void httpFailure()
- {
- LL_WARNS() << "Failed to commit estate info " << dumpResponse() << LL_ENDL;
- }
-};
-
// tries to send estate info using a cap; returns true if it succeeded
bool LLEstateInfoModel::commitEstateInfoCaps()
{
@@ -139,29 +123,53 @@ bool LLEstateInfoModel::commitEstateInfoCaps()
return false;
}
- LLSD body;
- body["estate_name" ] = getName();
- body["sun_hour" ] = getSunHour();
+ LLCoros::instance().launch("LLEstateInfoModel::commitEstateInfoCapsCoro",
+ boost::bind(&LLEstateInfoModel::commitEstateInfoCapsCoro, this, _1, url));
- body["is_sun_fixed" ] = getUseFixedSun();
- body["is_externally_visible"] = getIsExternallyVisible();
- body["allow_direct_teleport"] = getAllowDirectTeleport();
- body["deny_anonymous" ] = getDenyAnonymous();
- body["deny_age_unverified" ] = getDenyAgeUnverified();
- body["allow_voice_chat" ] = getAllowVoiceChat();
-
- body["invoice" ] = LLFloaterRegionInfo::getLastInvoice();
-
- LL_DEBUGS("Windlight Sync") << "Sending estate caps: "
- << "is_sun_fixed = " << getUseFixedSun()
- << ", sun_hour = " << getSunHour() << LL_ENDL;
- LL_DEBUGS() << body << LL_ENDL;
-
- // we use a responder so that we can re-get the data after committing to the database
- LLHTTPClient::post(url, body, new LLEstateChangeInfoResponder);
return true;
}
+void LLEstateInfoModel::commitEstateInfoCapsCoro(LLCoros::self& self, std::string url)
+{
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("EstateChangeInfo", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+
+ LLSD body;
+ body["estate_name"] = getName();
+ body["sun_hour"] = getSunHour();
+
+ body["is_sun_fixed"] = getUseFixedSun();
+ body["is_externally_visible"] = getIsExternallyVisible();
+ body["allow_direct_teleport"] = getAllowDirectTeleport();
+ body["deny_anonymous"] = getDenyAnonymous();
+ body["deny_age_unverified"] = getDenyAgeUnverified();
+ body["allow_voice_chat"] = getAllowVoiceChat();
+
+ body["invoice"] = LLFloaterRegionInfo::getLastInvoice();
+
+ LL_DEBUGS("Windlight Sync") << "Sending estate caps: "
+ << "is_sun_fixed = " << getUseFixedSun()
+ << ", sun_hour = " << getSunHour() << LL_ENDL;
+ LL_DEBUGS() << body << LL_ENDL;
+
+ LLSD result = httpAdapter->postAndYield(self, httpRequest, url, body);
+
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
+
+ if (status)
+ {
+ LL_INFOS() << "Committed estate info" << LL_ENDL;
+ LLEstateInfoModel::instance().notifyCommit();
+ }
+ else
+ {
+ LL_WARNS() << "Failed to commit estate info " << LL_ENDL;
+ }
+}
+
/* This is the old way of doing things, is deprecated, and should be
deleted when the dataserver model can be removed */
// key = "estatechangeinfo"
diff --git a/indra/newview/llestateinfomodel.h b/indra/newview/llestateinfomodel.h
index 538f2f7c75..2deae7e322 100755
--- a/indra/newview/llestateinfomodel.h
+++ b/indra/newview/llestateinfomodel.h
@@ -30,6 +30,8 @@
class LLMessageSystem;
#include "llsingleton.h"
+#include "llcoros.h"
+#include "lleventcoro.h"
/**
* Contains estate info, notifies interested parties of its changes.
@@ -73,7 +75,6 @@ protected:
friend class LLSingleton<LLEstateInfoModel>;
friend class LLDispatchEstateUpdateInfo;
- friend class LLEstateChangeInfoResponder;
LLEstateInfoModel();
@@ -99,6 +100,8 @@ private:
update_signal_t mUpdateSignal; /// emitted when we receive update from sim
update_signal_t mCommitSignal; /// emitted when our update gets applied to sim
+
+ void commitEstateInfoCapsCoro(LLCoros::self& self, std::string url);
};
inline bool LLEstateInfoModel::getFlag(U64 flag) const