diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2012-03-05 18:49:27 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2012-03-05 18:49:27 -0500 |
commit | 63b393da31e9fb972428fe957a05955a3d903113 (patch) | |
tree | cc49e98e62b46077bc8301b5d7ce8df1f7822a14 /indra/llcommon/llleap.cpp | |
parent | f02ded46fe6f166a07673d97301bf169eb0b9ba8 (diff) |
Introduce (disabled) LLLeap debugging code to validate stdin writes.
While debugging mysterious problem on Windows, one potential failure mode to
rule out was the possibility that streaming std::ostringstream <<
LLSDNotationStreamer(large_LLSD) might itself cause trouble -- even before
attempting to write to the LLProcess::WritePipe. The debugging code validated
that the correct length is being reported, and that deserializing the
resulting buffer produces equivalent LLSD. This code verified correct
operation, and so has been disabled, as it's expensive at runtime.
Diffstat (limited to 'indra/llcommon/llleap.cpp')
-rw-r--r-- | indra/llcommon/llleap.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index 34f77c3f3a..034c809330 100644 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -192,6 +192,31 @@ public: std::ostringstream buffer; buffer << LLSDNotationStreamer(packet); +/*==========================================================================*| + // 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() << " != " + << "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) + { + LL_ERRS("LLLeap") << "LLSDNotationParser() cannot parse output of " + << "LLSDNotationStreamer()" << LL_ENDL; + } + if (! llsd_equals(echo, packet)) + { + LL_ERRS("LLLeap") << "LLSDNotationParser() produced different LLSD " + << "than passed to LLSDNotationStreamer()" << LL_ENDL; + } +|*==========================================================================*/ + LL_DEBUGS("EventHost") << "Sending: " << buffer.tellp() << ':'; std::string::size_type truncate(80); if (buffer.tellp() <= truncate) |