summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/lldispatcher.cpp47
-rw-r--r--indra/llmessage/llmessagereader.h6
-rw-r--r--indra/llmessage/llregionpresenceverifier.cpp31
-rw-r--r--indra/llmessage/llregionpresenceverifier.h2
-rw-r--r--indra/llmessage/lltemplatemessagereader.cpp44
-rw-r--r--indra/llmessage/message_prehash.cpp5
-rw-r--r--indra/llmessage/message_prehash.h4
7 files changed, 84 insertions, 55 deletions
diff --git a/indra/llmessage/lldispatcher.cpp b/indra/llmessage/lldispatcher.cpp
index bb7c833b49..6632fbb67e 100644
--- a/indra/llmessage/lldispatcher.cpp
+++ b/indra/llmessage/lldispatcher.cpp
@@ -121,29 +121,32 @@ bool LLDispatcher::unpackMessage(
// we treat the SParam as binary data (since it might be an
// LLUUID in compressed form which may have embedded \0's,)
size = msg->getSizeFast(_PREHASH_ParamList, i, _PREHASH_Parameter);
- msg->getBinaryDataFast(
- _PREHASH_ParamList, _PREHASH_Parameter,
- buf, size, i, MAX_STRING-1);
-
- // If the last byte of the data is 0x0, this is either a normally
- // packed string, or a binary packed UUID (which for these messages
- // are packed with a 17th byte 0x0). Unpack into a std::string
- // without the trailing \0, so "abc\0" becomes std::string("abc", 3)
- // which matches const char* "abc".
- if (size > 0
- && buf[size-1] == 0x0)
- {
- // special char*/size constructor because UUIDs may have embedded
- // 0x0 bytes.
- std::string binary_data(buf, size-1);
- parameters.push_back(binary_data);
- }
- else
+ if (size >= 0)
{
- // This is either a NULL string, or a string that was packed
- // incorrectly as binary data, without the usual trailing '\0'.
- std::string string_data(buf, size);
- parameters.push_back(string_data);
+ msg->getBinaryDataFast(
+ _PREHASH_ParamList, _PREHASH_Parameter,
+ buf, size, i, MAX_STRING-1);
+
+ // If the last byte of the data is 0x0, this is either a normally
+ // packed string, or a binary packed UUID (which for these messages
+ // are packed with a 17th byte 0x0). Unpack into a std::string
+ // without the trailing \0, so "abc\0" becomes std::string("abc", 3)
+ // which matches const char* "abc".
+ if (size > 0
+ && buf[size-1] == 0x0)
+ {
+ // special char*/size constructor because UUIDs may have embedded
+ // 0x0 bytes.
+ std::string binary_data(buf, size-1);
+ parameters.push_back(binary_data);
+ }
+ else
+ {
+ // This is either a NULL string, or a string that was packed
+ // incorrectly as binary data, without the usual trailing '\0'.
+ std::string string_data(buf, size);
+ parameters.push_back(string_data);
+ }
}
}
return true;
diff --git a/indra/llmessage/llmessagereader.h b/indra/llmessage/llmessagereader.h
index 167313b9b9..6edc2f34af 100644
--- a/indra/llmessage/llmessagereader.h
+++ b/indra/llmessage/llmessagereader.h
@@ -44,6 +44,12 @@ class LLVector3;
class LLVector3d;
class LLVector4;
+// Error return values for getSize() functions
+const S32 LL_BLOCK_NOT_IN_MESSAGE = -1;
+const S32 LL_VARIABLE_NOT_IN_BLOCK = -2;
+const S32 LL_MESSAGE_ERROR = -3;
+
+
class LLMessageReader
{
public:
diff --git a/indra/llmessage/llregionpresenceverifier.cpp b/indra/llmessage/llregionpresenceverifier.cpp
index f206a40b0b..552cf4cbdb 100644
--- a/indra/llmessage/llregionpresenceverifier.cpp
+++ b/indra/llmessage/llregionpresenceverifier.cpp
@@ -41,7 +41,7 @@ void LLRegionPresenceVerifier::RegionResponder::result(const LLSD& content)
llinfos << "Verifying " << destination.getString() << " is region " << id << llendl;
std::stringstream uri;
- uri << "http://" << destination.getString() << "/state/basic";
+ uri << "http://" << destination.getString() << "/state/basic/";
mSharedData->getHttpClient().get(uri.str(), new VerifiedDestinationResponder(mSharedData, content));
}
@@ -68,20 +68,35 @@ void LLRegionPresenceVerifier::VerifiedDestinationResponder::result(const LLSD&
LLUUID actual_region_id = content["region_id"];
LLUUID expected_region_id = mContent["region_id"];
- if (mSharedData->checkValidity(content))
+ lldebugs << "Actual region: " << content << llendl;
+ lldebugs << "Expected region: " << mContent << llendl;
+
+ if (mSharedData->checkValidity(content) &&
+ (actual_region_id == expected_region_id))
{
mSharedData->onRegionVerified(mContent);
}
- else if ((mSharedData->shouldRetry()) && (actual_region_id != expected_region_id)) // If the region is correct, then it means we've deliberately changed the data
+ else if (mSharedData->shouldRetry())
{
- LLSD headers;
- headers["Cache-Control"] = "no-cache, max-age=0";
- llinfos << "Requesting region information, get uncached for region " << mSharedData->getRegionUri() << llendl;
- mSharedData->decrementRetries();
- mSharedData->getHttpClient().get(mSharedData->getRegionUri(), new RegionResponder(mSharedData), headers);
+ retry();
}
else
{
llwarns << "Could not correctly look up region from region presence service. Region: " << mSharedData->getRegionUri() << llendl;
}
}
+
+void LLRegionPresenceVerifier::VerifiedDestinationResponder::retry()
+{
+ LLSD headers;
+ headers["Cache-Control"] = "no-cache, max-age=0";
+ llinfos << "Requesting region information, get uncached for region " << mSharedData->getRegionUri() << llendl;
+ mSharedData->decrementRetries();
+ mSharedData->getHttpClient().get(mSharedData->getRegionUri(), new RegionResponder(mSharedData), headers);
+}
+
+void LLRegionPresenceVerifier::VerifiedDestinationResponder::error(U32 status, const std::string& reason)
+{
+ retry();
+}
+
diff --git a/indra/llmessage/llregionpresenceverifier.h b/indra/llmessage/llregionpresenceverifier.h
index 41c53762b6..d1de608ec6 100644
--- a/indra/llmessage/llregionpresenceverifier.h
+++ b/indra/llmessage/llregionpresenceverifier.h
@@ -71,7 +71,9 @@ public:
public:
VerifiedDestinationResponder(ResponsePtr data, const LLSD& content);
virtual void result(const LLSD& content);
+ virtual void error(U32 status, const std::string& reason);
private:
+ void retry();
ResponsePtr mSharedData;
LLSD mContent;
};
diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp
index 40e46b0ce9..80ea6ce96b 100644
--- a/indra/llmessage/lltemplatemessagereader.cpp
+++ b/indra/llmessage/lltemplatemessagereader.cpp
@@ -182,15 +182,15 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname)
{
// is there a message ready to go?
if (mReceiveSize == -1)
- {
+ { // This is a serious error - crash
llerrs << "No message waiting for decode 4!" << llendl;
- return -1;
+ return LL_MESSAGE_ERROR;
}
if (!mCurrentRMessageData)
- {
+ { // This is a serious error - crash
llerrs << "Invalid mCurrentRMessageData in getData!" << llendl;
- return -1;
+ return LL_MESSAGE_ERROR;
}
char *bnamep = (char *)blockname;
@@ -198,10 +198,10 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname)
LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep);
if (iter == mCurrentRMessageData->mMemberBlocks.end())
- {
- llerrs << "Block " << bnamep << " not in message "
+ { // don't crash
+ llinfos << "Block " << bnamep << " not in message "
<< mCurrentRMessageData->mName << llendl;
- return -1;
+ return LL_BLOCK_NOT_IN_MESSAGE;
}
char *vnamep = (char *)varname;
@@ -210,17 +210,17 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname)
LLMsgVarData& vardata = msg_data->mMemberVarData[vnamep];
if (!vardata.getName())
- {
- llerrs << "Variable " << varname << " not in message "
+ { // don't crash
+ llinfos << "Variable " << varname << " not in message "
<< mCurrentRMessageData->mName << " block " << bnamep << llendl;
- return -1;
+ return LL_VARIABLE_NOT_IN_BLOCK;
}
if (mCurrentRMessageTemplate->mMemberBlocks[bnamep]->mType != MBT_SINGLE)
- {
+ { // This is a serious error - crash
llerrs << "Block " << bnamep << " isn't type MBT_SINGLE,"
" use getSize with blocknum argument!" << llendl;
- return -1;
+ return LL_MESSAGE_ERROR;
}
return vardata.getSize();
@@ -230,15 +230,15 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const
{
// is there a message ready to go?
if (mReceiveSize == -1)
- {
+ { // This is a serious error - crash
llerrs << "No message waiting for decode 5!" << llendl;
- return -1;
+ return LL_MESSAGE_ERROR;
}
if (!mCurrentRMessageData)
- {
+ { // This is a serious error - crash
llerrs << "Invalid mCurrentRMessageData in getData!" << llendl;
- return -1;
+ return LL_MESSAGE_ERROR;
}
char *bnamep = (char *)blockname + blocknum;
@@ -247,20 +247,20 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const
LLMsgData::msg_blk_data_map_t::const_iterator iter = mCurrentRMessageData->mMemberBlocks.find(bnamep);
if (iter == mCurrentRMessageData->mMemberBlocks.end())
- {
- llerrs << "Block " << bnamep << " not in message "
+ { // don't crash
+ llinfos << "Block " << bnamep << " not in message "
<< mCurrentRMessageData->mName << llendl;
- return -1;
+ return LL_BLOCK_NOT_IN_MESSAGE;
}
LLMsgBlkData* msg_data = iter->second;
LLMsgVarData& vardata = msg_data->mMemberVarData[vnamep];
if (!vardata.getName())
- {
- llerrs << "Variable " << vnamep << " not in message "
+ { // don't crash
+ llinfos << "Variable " << vnamep << " not in message "
<< mCurrentRMessageData->mName << " block " << bnamep << llendl;
- return -1;
+ return LL_VARIABLE_NOT_IN_BLOCK;
}
return vardata.getSize();
diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp
index 716d895334..43b5f8e224 100644
--- a/indra/llmessage/message_prehash.cpp
+++ b/indra/llmessage/message_prehash.cpp
@@ -631,6 +631,8 @@ char* _PREHASH_OfferCallingCard = LLMessageStringTable::getInstance()->getString
char* _PREHASH_AcceptCallingCard = LLMessageStringTable::getInstance()->getString("AcceptCallingCard");
char* _PREHASH_DeclineCallingCard = LLMessageStringTable::getInstance()->getString("DeclineCallingCard");
char* _PREHASH_AgentAccess = LLMessageStringTable::getInstance()->getString("AgentAccess");
+char* _PREHASH_AgentLegacyAccess = LLMessageStringTable::getInstance()->getString("AgentLegacyAccess");
+char* _PREHASH_AgentMaxAccess = LLMessageStringTable::getInstance()->getString("AgentMaxAccess");
char* _PREHASH_DataHomeLocationReply = LLMessageStringTable::getInstance()->getString("DataHomeLocationReply");
char* _PREHASH_EventLocationReply = LLMessageStringTable::getInstance()->getString("EventLocationReply");
char* _PREHASH_TerseDateID = LLMessageStringTable::getInstance()->getString("TerseDateID");
@@ -1377,5 +1379,4 @@ char* _PREHASH_UCoord = LLMessageStringTable::getInstance()->getString("UCoord")
char* _PREHASH_VCoord = LLMessageStringTable::getInstance()->getString("VCoord");
char* _PREHASH_FaceIndex = LLMessageStringTable::getInstance()->getString("FaceIndex");
char* _PREHASH_StatusData = LLMessageStringTable::getInstance()->getString("StatusData");
-
-
+char* _PREHASH_ProductSKU = LLMessageStringTable::getInstance()->getString("ProductSKU");
diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h
index c7bb7fff26..f8ef610408 100644
--- a/indra/llmessage/message_prehash.h
+++ b/indra/llmessage/message_prehash.h
@@ -631,6 +631,8 @@ extern char * _PREHASH_OfferCallingCard;
extern char * _PREHASH_AcceptCallingCard;
extern char * _PREHASH_DeclineCallingCard;
extern char * _PREHASH_AgentAccess;
+extern char * _PREHASH_AgentLegacyAccess;
+extern char * _PREHASH_AgentMaxAccess;
extern char * _PREHASH_DataHomeLocationReply;
extern char * _PREHASH_EventLocationReply;
extern char * _PREHASH_TerseDateID;
@@ -1377,5 +1379,5 @@ extern char * _PREHASH_UCoord;
extern char * _PREHASH_VCoord;
extern char * _PREHASH_FaceIndex;
extern char * _PREHASH_StatusData;
-
+extern char * _PREHASH_ProductSKU;
#endif