summaryrefslogtreecommitdiff
path: root/indra/llcommon/llleap.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2022-11-29 14:03:02 -0500
committerNat Goodspeed <nat@lindenlab.com>2022-11-29 14:03:02 -0500
commitb180e4de23cb54ec385e2d999fc5fdd4ea804ba4 (patch)
tree9fa40994be8712cb15608ee5fbadeb1f9bece427 /indra/llcommon/llleap.cpp
parent42e0787446d35bf967ff088148f8ad5f902e929b (diff)
SL-18330: WIP: Send LLLeap to child as binary LLSD; generic parser.
Since parsing binary LLSD is faster than parsing notation LLSD, send data from the viewer to the LEAP plugin child process's stdin in binary instead of notation. Similarly, instead of parsing the child process's stdout using specifically a notation parser, use the generic LLSDSerialize::deserialize() LLSD parser. Add more LLSDSerialize Python compatibility tests.
Diffstat (limited to 'indra/llcommon/llleap.cpp')
-rw-r--r--indra/llcommon/llleap.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp
index 2704f8b6de..f71eaf92c4 100644
--- a/indra/llcommon/llleap.cpp
+++ b/indra/llcommon/llleap.cpp
@@ -204,30 +204,35 @@ public:
LLSD packet(LLSDMap("pump", pump)("data", data));
std::ostringstream buffer;
- buffer << LLSDNotationStreamer(packet);
+ // SL-18330: for large data blocks, it's much faster to parse binary
+ // LLSD than notation LLSD. Use serialize(LLSD_BINARY) rather than
+ // directly calling LLSDBinaryFormatter because, unlike the latter,
+ // serialize() prepends the relevant header, needed by a general-
+ // purpose LLSD parser to distinguish binary from notation.
+ LLSDSerialize::serialize(packet, buffer, LLSDSerialize::LLSD_BINARY,
+ LLSDFormatter::OPTIONS_NONE);
/*==========================================================================*|
// DEBUGGING ONLY: don't copy str() if we can avoid it.
std::string strdata(buffer.str());
if (std::size_t(buffer.tellp()) != strdata.length())
{
- LL_ERRS("LLLeap") << "tellp() -> " << buffer.tellp() << " != "
+ LL_ERRS("LLLeap") << "tellp() -> " << static_cast<U64>(buffer.tellp()) << " != "
<< "str().length() -> " << strdata.length() << LL_ENDL;
}
// DEBUGGING ONLY: reading back is terribly inefficient.
std::istringstream readback(strdata);
LLSD echo;
- LLPointer<LLSDParser> parser(new LLSDNotationParser());
- S32 parse_status(parser->parse(readback, echo, strdata.length()));
- if (parse_status == LLSDParser::PARSE_FAILURE)
+ bool parse_status(LLSDSerialize::deserialize(echo, readback, strdata.length()));
+ if (! parse_status)
{
- LL_ERRS("LLLeap") << "LLSDNotationParser() cannot parse output of "
- << "LLSDNotationStreamer()" << LL_ENDL;
+ LL_ERRS("LLLeap") << "LLSDSerialize::deserialize() cannot parse output of "
+ << "LLSDSerialize::serialize(LLSD_BINARY)" << LL_ENDL;
}
if (! llsd_equals(echo, packet))
{
- LL_ERRS("LLLeap") << "LLSDNotationParser() produced different LLSD "
- << "than passed to LLSDNotationStreamer()" << LL_ENDL;
+ LL_ERRS("LLLeap") << "LLSDSerialize::deserialize() returned different LLSD "
+ << "than passed to LLSDSerialize::serialize()" << LL_ENDL;
}
|*==========================================================================*/
@@ -312,9 +317,8 @@ public:
LL_DEBUGS("LLLeap") << "needed " << mExpect << " bytes, got "
<< childout.size() << ", parsing LLSD" << LL_ENDL;
LLSD data;
- LLPointer<LLSDParser> parser(new LLSDNotationParser());
- S32 parse_status(parser->parse(childout.get_istream(), data, mExpect));
- if (parse_status == LLSDParser::PARSE_FAILURE)
+ bool parse_status(LLSDSerialize::deserialize(data, childout.get_istream(), mExpect));
+ if (! parse_status)
{
bad_protocol("unparseable LLSD data");
}