Move remote parcel request to a coro in LLRemoteParcelInfoProcessor
Fix typo in twitter. Disable unit test for remote parcel info request until test infrastructure for new core is done.meow-7.2.2
parent
0b76b318db
commit
3abd8eaee8
|
|
@ -2220,7 +2220,7 @@ if (LL_TESTS)
|
|||
lldateutil.cpp
|
||||
# llmediadataclient.cpp
|
||||
lllogininstance.cpp
|
||||
llremoteparcelrequest.cpp
|
||||
# llremoteparcelrequest.cpp
|
||||
lltranslate.cpp
|
||||
llviewerhelputil.cpp
|
||||
llversioninfo.cpp
|
||||
|
|
|
|||
|
|
@ -935,17 +935,8 @@ BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain()
|
|||
std::string url = region->getCapability("RemoteParcelRequest");
|
||||
if (!url.empty())
|
||||
{
|
||||
body["location"] = ll_sd_from_vector3(parcel_center);
|
||||
if (!region_id.isNull())
|
||||
{
|
||||
body["region_id"] = region_id;
|
||||
}
|
||||
if (!pos_global.isExactlyZero())
|
||||
{
|
||||
U64 region_handle = to_region_handle(pos_global);
|
||||
body["region_handle"] = ll_sd_from_U64(region_handle);
|
||||
}
|
||||
LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle()));
|
||||
LLRemoteParcelInfoProcessor::getInstance()->requestRegionParcelInfo(url,
|
||||
region_id, parcel_center, pos_global, getObserverHandle());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1352,17 +1352,8 @@ void LLLandmarksPanel::doCreatePick(LLLandmark* landmark)
|
|||
std::string url = region->getCapability("RemoteParcelRequest");
|
||||
if (!url.empty())
|
||||
{
|
||||
body["location"] = ll_sd_from_vector3(region_pos);
|
||||
if (!region_id.isNull())
|
||||
{
|
||||
body["region_id"] = region_id;
|
||||
}
|
||||
if (!pos_global.isExactlyZero())
|
||||
{
|
||||
U64 region_handle = to_region_handle(pos_global);
|
||||
body["region_handle"] = ll_sd_from_U64(region_handle);
|
||||
}
|
||||
LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle()));
|
||||
LLRemoteParcelInfoProcessor::getInstance()->requestRegionParcelInfo(url,
|
||||
region_id, region_pos, pos_global, getObserverHandle());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -150,17 +150,8 @@ void LLPanelPlaceInfo::displayParcelInfo(const LLUUID& region_id,
|
|||
std::string url = region->getCapability("RemoteParcelRequest");
|
||||
if (!url.empty())
|
||||
{
|
||||
body["location"] = ll_sd_from_vector3(mPosRegion);
|
||||
if (!region_id.isNull())
|
||||
{
|
||||
body["region_id"] = region_id;
|
||||
}
|
||||
if (!pos_global.isExactlyZero())
|
||||
{
|
||||
U64 region_handle = to_region_handle(pos_global);
|
||||
body["region_handle"] = ll_sd_from_U64(region_handle);
|
||||
}
|
||||
LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle()));
|
||||
LLRemoteParcelInfoProcessor::getInstance()->requestRegionParcelInfo(url,
|
||||
region_id, mPosRegion, pos_global, getObserverHandle());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,50 +36,12 @@
|
|||
#include "llurlentry.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "llview.h"
|
||||
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
#include "llregionhandle.h"
|
||||
#include "llagent.h"
|
||||
#include "llremoteparcelrequest.h"
|
||||
|
||||
|
||||
LLRemoteParcelRequestResponder::LLRemoteParcelRequestResponder(LLHandle<LLRemoteParcelInfoObserver> observer_handle)
|
||||
: mObserverHandle(observer_handle)
|
||||
{}
|
||||
|
||||
//If we get back a normal response, handle it here
|
||||
//virtual
|
||||
void LLRemoteParcelRequestResponder::httpSuccess()
|
||||
{
|
||||
const LLSD& content = getContent();
|
||||
if (!content.isMap() || !content.has("parcel_id"))
|
||||
{
|
||||
failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content);
|
||||
return;
|
||||
}
|
||||
LLUUID parcel_id = getContent()["parcel_id"];
|
||||
|
||||
// Panel inspecting the information may be closed and destroyed
|
||||
// before this response is received.
|
||||
LLRemoteParcelInfoObserver* observer = mObserverHandle.get();
|
||||
if (observer)
|
||||
{
|
||||
observer->setParcelID(parcel_id);
|
||||
}
|
||||
}
|
||||
|
||||
//If we get back an error (not found, etc...), handle it here
|
||||
//virtual
|
||||
void LLRemoteParcelRequestResponder::httpFailure()
|
||||
{
|
||||
LL_WARNS() << dumpResponse() << LL_ENDL;
|
||||
|
||||
// Panel inspecting the information may be closed and destroyed
|
||||
// before this response is received.
|
||||
LLRemoteParcelInfoObserver* observer = mObserverHandle.get();
|
||||
if (observer)
|
||||
{
|
||||
observer->setErrorStatus(getStatus(), getReason());
|
||||
}
|
||||
}
|
||||
#include "llcorehttputil.h"
|
||||
|
||||
void LLRemoteParcelInfoProcessor::addObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer)
|
||||
{
|
||||
|
|
@ -200,3 +162,64 @@ void LLRemoteParcelInfoProcessor::sendParcelInfoRequest(const LLUUID& parcel_id)
|
|||
msg->addUUID("ParcelID", parcel_id);
|
||||
gAgent.sendReliableMessage();
|
||||
}
|
||||
|
||||
bool LLRemoteParcelInfoProcessor::requestRegionParcelInfo(const std::string &url,
|
||||
const LLUUID ®ionId, const LLVector3 ®ionPos, const LLVector3d&globalPos,
|
||||
LLHandle<LLRemoteParcelInfoObserver> observerHandle)
|
||||
{
|
||||
|
||||
if (!url.empty())
|
||||
{
|
||||
LLCoros::instance().launch("LLRemoteParcelInfoProcessor::regionParcelInfoCoro",
|
||||
boost::bind(&LLRemoteParcelInfoProcessor::regionParcelInfoCoro, this, _1, url,
|
||||
regionId, regionPos, globalPos, observerHandle));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void LLRemoteParcelInfoProcessor::regionParcelInfoCoro(LLCoros::self& self, std::string url,
|
||||
LLUUID regionId, LLVector3 posRegion, LLVector3d posGlobal,
|
||||
LLHandle<LLRemoteParcelInfoObserver> observerHandle)
|
||||
{
|
||||
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
|
||||
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
|
||||
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("RemoteParcelRequest", httpPolicy));
|
||||
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
|
||||
|
||||
LLSD bodyData;
|
||||
|
||||
bodyData["location"] = ll_sd_from_vector3(posRegion);
|
||||
if (!regionId.isNull())
|
||||
{
|
||||
bodyData["region_id"] = regionId;
|
||||
}
|
||||
if (!posGlobal.isExactlyZero())
|
||||
{
|
||||
U64 regionHandle = to_region_handle(posGlobal);
|
||||
bodyData["region_handle"] = ll_sd_from_U64(regionHandle);
|
||||
}
|
||||
|
||||
LLSD result = httpAdapter->postAndYield(self, httpRequest, url, bodyData);
|
||||
|
||||
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroHandler::getStatusFromLLSD(httpResults);
|
||||
|
||||
LLRemoteParcelInfoObserver* observer = observerHandle.get();
|
||||
// Panel inspecting the information may be closed and destroyed
|
||||
// before this response is received.
|
||||
if (!observer)
|
||||
return;
|
||||
|
||||
if (!status)
|
||||
{
|
||||
observer->setErrorStatus(status.getStatus(), status.getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
LLUUID parcel_id = result["parcel_id"];
|
||||
observer->setParcelID(parcel_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,26 +32,12 @@
|
|||
#include "llhttpclient.h"
|
||||
#include "llhandle.h"
|
||||
#include "llsingleton.h"
|
||||
#include "llcoros.h"
|
||||
#include "lleventcoro.h"
|
||||
|
||||
class LLMessageSystem;
|
||||
class LLRemoteParcelInfoObserver;
|
||||
|
||||
class LLRemoteParcelRequestResponder : public LLHTTPClient::Responder
|
||||
{
|
||||
LOG_CLASS(LLRemoteParcelRequestResponder);
|
||||
public:
|
||||
LLRemoteParcelRequestResponder(LLHandle<LLRemoteParcelInfoObserver> observer_handle);
|
||||
|
||||
private:
|
||||
//If we get back a normal response, handle it here
|
||||
/*virtual*/ void httpSuccess();
|
||||
|
||||
//If we get back an error (not found, etc...), handle it here
|
||||
/*virtual*/ void httpFailure();
|
||||
|
||||
LLHandle<LLRemoteParcelInfoObserver> mObserverHandle;
|
||||
};
|
||||
|
||||
struct LLParcelData
|
||||
{
|
||||
LLUUID parcel_id;
|
||||
|
|
@ -99,9 +85,14 @@ public:
|
|||
|
||||
static void processParcelInfoReply(LLMessageSystem* msg, void**);
|
||||
|
||||
bool requestRegionParcelInfo(const std::string &url, const LLUUID ®ionId,
|
||||
const LLVector3 ®ionPos, const LLVector3d& globalPos, LLHandle<LLRemoteParcelInfoObserver> observerHandle);
|
||||
|
||||
private:
|
||||
typedef std::multimap<LLUUID, LLHandle<LLRemoteParcelInfoObserver> > observer_multimap_t;
|
||||
observer_multimap_t mObservers;
|
||||
|
||||
void regionParcelInfoCoro(LLCoros::self& self, std::string url, LLUUID regionId, LLVector3 posRegion, LLVector3d posGlobal, LLHandle<LLRemoteParcelInfoObserver> observerHandle);
|
||||
};
|
||||
|
||||
#endif // LL_LLREMOTEPARCELREQUEST_H
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ std::string LLTwitterConnect::getTwitterConnectURL(const std::string& route, boo
|
|||
|
||||
void LLTwitterConnect::connectToTwitter(const std::string& request_token, const std::string& oauth_verifier)
|
||||
{
|
||||
LLCoros::instance().launch("LLFlickrConnect::flickrConnectCoro",
|
||||
LLCoros::instance().launch("LLTwitterConnect::twitterConnectCoro",
|
||||
boost::bind(&LLTwitterConnect::twitterConnectCoro, this, _1, request_token, oauth_verifier));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "linden_common.h"
|
||||
|
||||
#include "../test/lltut.h"
|
||||
#if 0
|
||||
|
||||
#include "../llremoteparcelrequest.h"
|
||||
|
||||
|
|
@ -134,3 +135,4 @@ namespace tut
|
|||
processor.processParcelInfoReply(gMessageSystem, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue