summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2015-05-22 09:27:33 -0700
committerRider Linden <rider@lindenlab.com>2015-05-22 09:27:33 -0700
commitff121254b29ea628472faf1eda06058f06c050d1 (patch)
treed9ec3617ba8a742e45180c8a18aba2a49c8a5d4c /indra/newview
parentc437a9c4ec865c38366c8057010d24311888ecb1 (diff)
Removed dead HTTP client adapter code
Partial conversion of group manager clean up some debug code in web profiles.
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llgroupmgr.cpp183
-rwxr-xr-xindra/newview/llgroupmgr.h18
-rwxr-xr-xindra/newview/llwebprofile.cpp24
3 files changed, 153 insertions, 72 deletions
diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp
index 56e671d902..21220507e7 100755
--- a/indra/newview/llgroupmgr.cpp
+++ b/indra/newview/llgroupmgr.cpp
@@ -53,6 +53,7 @@
#include "lltrans.h"
#include "llviewerregion.h"
#include <boost/regex.hpp>
+#include "llcorehttputil.h"
#if LL_MSVC
#pragma warning(push)
@@ -768,9 +769,9 @@ void LLGroupMgrGroupData::removeBanEntry(const LLUUID& ban_id)
// LLGroupMgr
//
-LLGroupMgr::LLGroupMgr()
+LLGroupMgr::LLGroupMgr():
+ mMemberRequestInFlight(false)
{
- mLastGroupMembersRequestFrame = 0;
}
LLGroupMgr::~LLGroupMgr()
@@ -1861,7 +1862,7 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id,
group_datap->mMemberVersion.generate();
}
-
+#if 1
// Responder class for capability group management
class GroupBanDataResponder : public LLHTTPClient::Responder
{
@@ -1900,6 +1901,77 @@ void GroupBanDataResponder::httpSuccess()
}
}
+#else
+//void LLGroupMgr::groupBanRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId,
+// LLGroupMgr::EBanRequestAction action, uuid_vec_t banList)
+void LLGroupMgr::groupBanRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId,
+ LLGroupMgr::EBanRequestAction action, LLSD body)
+{
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("groupMembersRequest", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+
+ std::string finalUrl = url + "?group_id=" + groupId.asString();
+
+ EBanRequestAction currAction = action;
+
+ do
+ {
+ LLSD result;
+
+ if (currAction & (BAN_CREATE | BAN_DELETE)) // these two actions result in POSTS
+ { // build the post data.
+// LLSD postData = LLSD::emptyMap();
+//
+// postData["ban_action"] = (LLSD::Integer)(currAction & ~BAN_UPDATE);
+// // Add our list of potential banned residents to the list
+// postData["ban_ids"] = LLSD::emptyArray();
+//
+// LLSD banEntry;
+// for (uuid_vec_t::const_iterator it = banList.begin(); it != banList.end(); ++it)
+// {
+// banEntry = (*it);
+// postData["ban_ids"].append(banEntry);
+// }
+//
+// result = httpAdapter->postAndYield(self, httpRequest, finalUrl, postData);
+
+ result = httpAdapter->postAndYield(self, httpRequest, finalUrl, body);
+ }
+ else
+ {
+ result = httpAdapter->getAndYield(self, httpRequest, finalUrl);
+ }
+
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+
+ if (!status)
+ {
+ LL_WARNS("GrpMgr") << "Error receiving group member data " << LL_ENDL;
+ return;
+ }
+
+ if (result.has("ban_list"))
+ {
+ result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);
+ // group ban data received
+ processGroupBanRequest(result);
+ }
+
+ if (currAction & BAN_UPDATE)
+ {
+ currAction = BAN_NO_ACTION;
+ continue;
+ }
+ break;
+ } while (true);
+}
+
+#endif
+
+
void LLGroupMgr::sendGroupBanRequest( EBanRequestType request_type,
const LLUUID& group_id,
U32 ban_action, /* = BAN_NO_ACTION */
@@ -1925,7 +1997,32 @@ void LLGroupMgr::sendGroupBanRequest( EBanRequestType request_type,
{
return;
}
- cap_url += "?group_id=" + group_id.asString();
+
+#if 0
+
+ LLSD body = LLSD::emptyMap();
+ body["ban_action"] = (LLSD::Integer)(ban_action & ~BAN_UPDATE);
+ // Add our list of potential banned residents to the list
+ body["ban_ids"] = LLSD::emptyArray();
+ LLSD ban_entry;
+
+ uuid_vec_t::const_iterator iter = ban_list.begin();
+ for (; iter != ban_list.end(); ++iter)
+ {
+ ban_entry = (*iter);
+ body["ban_ids"].append(ban_entry);
+ }
+
+ LLCoros::instance().launch("LLGroupMgr::groupBanRequestCoro",
+ boost::bind(&LLGroupMgr::groupBanRequestCoro, this, _1, cap_url, group_id,
+ static_cast<LLGroupMgr::EBanRequestAction>(ban_action), body));
+
+// LLCoros::instance().launch("LLGroupMgr::groupBanRequestCoro",
+// boost::bind(&LLGroupMgr::groupBanRequestCoro, this, _1, cap_url, group_id,
+// static_cast<LLGroupMgr::EBanRequestAction>(ban_action), ban_list));
+
+#else
+ cap_url += "?group_id=" + group_id.asString();
LLSD body = LLSD::emptyMap();
body["ban_action"] = (LLSD::Integer)(ban_action & ~BAN_UPDATE);
@@ -1953,9 +2050,9 @@ void LLGroupMgr::sendGroupBanRequest( EBanRequestType request_type,
case REQUEST_DEL:
break;
}
+#endif
}
-
void LLGroupMgr::processGroupBanRequest(const LLSD& content)
{
// Did we get anything in content?
@@ -1992,45 +2089,42 @@ void LLGroupMgr::processGroupBanRequest(const LLSD& content)
LLGroupMgr::getInstance()->notifyObservers(GC_BANLIST);
}
+void LLGroupMgr::groupMembersRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId)
+{
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("groupMembersRequest", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+ LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
+ mMemberRequestInFlight = true;
-// Responder class for capability group management
-class GroupMemberDataResponder : public LLHTTPClient::Responder
-{
- LOG_CLASS(GroupMemberDataResponder);
-public:
- GroupMemberDataResponder() {}
- virtual ~GroupMemberDataResponder() {}
+ LLSD postData = LLSD::emptyMap();
+ postData["group_id"] = groupId;
-private:
- /* virtual */ void httpSuccess();
- /* virtual */ void httpFailure();
- LLSD mMemberData;
-};
+ LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData, httpOpts);
-void GroupMemberDataResponder::httpFailure()
-{
- LL_WARNS("GrpMgr") << "Error receiving group member data "
- << dumpResponse() << LL_ENDL;
-}
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
-void GroupMemberDataResponder::httpSuccess()
-{
- const LLSD& content = getContent();
- if (!content.isMap())
- {
- failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content);
- return;
- }
- LLGroupMgr::processCapGroupMembersRequest(content);
-}
+ if (!status)
+ {
+ LL_WARNS("GrpMgr") << "Error receiving group member data " << LL_ENDL;
+ mMemberRequestInFlight = false;
+ return;
+ }
+ result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);
+ LLGroupMgr::processCapGroupMembersRequest(result);
+ mMemberRequestInFlight = false;
+}
-// static
void LLGroupMgr::sendCapGroupMembersRequest(const LLUUID& group_id)
{
+ static U32 lastGroupMemberRequestFrame = 0;
+
// Have we requested the information already this frame?
- if(mLastGroupMembersRequestFrame == gFrameCount)
+ if ((lastGroupMemberRequestFrame == gFrameCount) || (mMemberRequestInFlight))
return;
LLViewerRegion* currentRegion = gAgent.getRegion();
@@ -2059,20 +2153,13 @@ void LLGroupMgr::sendCapGroupMembersRequest(const LLUUID& group_id)
return;
}
- // Post to our service. Add a body containing the group_id.
- LLSD body = LLSD::emptyMap();
- body["group_id"] = group_id;
-
- LLHTTPClient::ResponderPtr grp_data_responder = new GroupMemberDataResponder();
-
- // This could take a while to finish, timeout after 5 minutes.
- LLHTTPClient::post(cap_url, body, grp_data_responder, LLSD(), 300);
+ lastGroupMemberRequestFrame = gFrameCount;
- mLastGroupMembersRequestFrame = gFrameCount;
+ LLCoros::instance().launch("LLGroupMgr::groupMembersRequestCoro",
+ boost::bind(&LLGroupMgr::groupMembersRequestCoro, this, _1, cap_url, group_id));
}
-// static
void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content)
{
// Did we get anything in content?
@@ -2089,7 +2176,7 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content)
LLUUID group_id = content["group_id"].asUUID();
- LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
+ LLGroupMgrGroupData* group_datap = getGroupData(group_id);
if(!group_datap)
{
LL_WARNS("GrpMgr") << "Received incorrect, possibly stale, group or request id" << LL_ENDL;
@@ -2183,7 +2270,7 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content)
// TODO:
// Refactor to reduce multiple calls for data we already have.
if(group_datap->mTitles.size() < 1)
- LLGroupMgr::getInstance()->sendGroupTitlesRequest(group_id);
+ sendGroupTitlesRequest(group_id);
group_datap->mMemberDataComplete = true;
@@ -2192,11 +2279,11 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content)
if (group_datap->mPendingRoleMemberRequest || !group_datap->mRoleMemberDataComplete)
{
group_datap->mPendingRoleMemberRequest = false;
- LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(group_id);
+ sendGroupRoleMembersRequest(group_id);
}
group_datap->mChanged = TRUE;
- LLGroupMgr::getInstance()->notifyObservers(GC_MEMBER_DATA);
+ notifyObservers(GC_MEMBER_DATA);
}
diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h
index 2e94e8d9a0..f41a637917 100755
--- a/indra/newview/llgroupmgr.h
+++ b/indra/newview/llgroupmgr.h
@@ -32,6 +32,8 @@
#include <vector>
#include <string>
#include <map>
+#include "lleventcoro.h"
+#include "llcoros.h"
// Forward Declarations
class LLMessageSystem;
@@ -362,6 +364,7 @@ public:
BAN_UPDATE = 4
};
+
public:
LLGroupMgr();
~LLGroupMgr();
@@ -396,15 +399,13 @@ public:
static void sendGroupMemberEjects(const LLUUID& group_id,
uuid_vec_t& member_ids);
- static void sendGroupBanRequest(EBanRequestType request_type,
+ void sendGroupBanRequest(EBanRequestType request_type,
const LLUUID& group_id,
U32 ban_action = BAN_NO_ACTION,
const uuid_vec_t ban_list = uuid_vec_t());
- static void processGroupBanRequest(const LLSD& content);
void sendCapGroupMembersRequest(const LLUUID& group_id);
- static void processCapGroupMembersRequest(const LLSD& content);
void cancelGroupRoleChanges(const LLUUID& group_id);
@@ -427,6 +428,15 @@ public:
void clearGroupData(const LLUUID& group_id);
private:
+ friend class GroupBanDataResponder;
+
+ void groupMembersRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId);
+ void processCapGroupMembersRequest(const LLSD& content);
+
+ //void groupBanRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId, EBanRequestAction action, uuid_vec_t banList);
+ void groupBanRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId, EBanRequestAction action, LLSD postBody);
+ static void processGroupBanRequest(const LLSD& content);
+
void notifyObservers(LLGroupChange gc);
void notifyObserver(const LLUUID& group_id, LLGroupChange gc);
void addGroup(LLGroupMgrGroupData* group_datap);
@@ -442,7 +452,7 @@ private:
typedef std::map<LLUUID,observer_set_t> observer_map_t;
observer_map_t mParticularObservers;
- S32 mLastGroupMembersRequestFrame;
+ bool mMemberRequestInFlight;
};
diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp
index 3d371e629f..df5f4e3588 100755
--- a/indra/newview/llwebprofile.cpp
+++ b/indra/newview/llwebprofile.cpp
@@ -131,10 +131,7 @@ void LLWebProfile::uploadImageCoro(LLCoros::self& self, LLPointer<LLImageFormatt
if (!status)
{
- std::ostringstream ostm;
- LLSDSerialize::toPrettyXML(httpResults, ostm);
LL_WARNS("Snapshots") << "Failed to get image upload config" << LL_ENDL;
- LL_WARNS("Snapshots") << ostm.str() << LL_ENDL;
LLWebProfile::reportImageUploadStatus(false);
return;
}
@@ -146,7 +143,7 @@ void LLWebProfile::uploadImageCoro(LLCoros::self& self, LLPointer<LLImageFormatt
const std::string boundary = "----------------------------0123abcdefab";
// a new set of headers.
- httpHeaders = buildDefaultHeaders();
+ httpHeaders = LLWebProfile::buildDefaultHeaders();
httpHeaders->append(HTTP_OUT_HEADER_COOKIE, getAuthCookie());
httpHeaders->remove(HTTP_OUT_HEADER_CONTENT_TYPE);
httpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, "multipart/form-data; boundary=" + boundary);
@@ -155,11 +152,6 @@ void LLWebProfile::uploadImageCoro(LLCoros::self& self, LLPointer<LLImageFormatt
result = httpAdapter->postAndYield(self, httpRequest, uploadUrl, body, httpOpts, httpHeaders);
- {
- std::ostringstream ostm;
- LLSDSerialize::toPrettyXML(result, ostm);
- LL_WARNS("Snapshots") << ostm.str() << LL_ENDL;
- }
body.reset();
httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
@@ -173,7 +165,7 @@ void LLWebProfile::uploadImageCoro(LLCoros::self& self, LLPointer<LLImageFormatt
LLSD resultHeaders = httpResults[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS];
- httpHeaders = buildDefaultHeaders();
+ httpHeaders = LLWebProfile::buildDefaultHeaders();
httpHeaders->append(HTTP_OUT_HEADER_COOKIE, getAuthCookie());
const std::string& redirUrl = resultHeaders[HTTP_IN_HEADER_LOCATION].asStringRef();
@@ -198,16 +190,10 @@ void LLWebProfile::uploadImageCoro(LLCoros::self& self, LLPointer<LLImageFormatt
return;
}
- LLSD raw = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW];
-// const LLSD::Binary &rawBin = raw.asBinary();
-// std::istringstream rawresult(rawBin.begin(), rawBin.end());
+ //LLSD raw = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW];
-// LLBufferStream istr(channels, buffer.get());
-// std::stringstream strstrm;
-// strstrm << istr.rdbuf();
-// const std::string body = strstrm.str();
LL_INFOS("Snapshots") << "Image uploaded." << LL_ENDL;
- LL_DEBUGS("Snapshots") << "Uploading image succeeded. Response: [" << raw.asString() << "]" << LL_ENDL;
+ //LL_DEBUGS("Snapshots") << "Uploading image succeeded. Response: [" << raw.asString() << "]" << LL_ENDL;
LLWebProfile::reportImageUploadStatus(true);
@@ -219,8 +205,6 @@ LLCore::BufferArray::ptr_t LLWebProfile::buildPostData(const LLSD &data, LLPoint
LLCore::BufferArray::ptr_t body(new LLCore::BufferArray);
LLCore::BufferArrayStream bas(body.get());
- // std::ostringstream body;
-
// *NOTE: The order seems to matter.
bas << "--" << boundary << "\r\n"
<< "Content-Disposition: form-data; name=\"key\"\r\n\r\n"