Debugger: Use fragments for long chunks.

Gets it on the wire faster.  More importantly, this allows us to usually
avoid rampant memory allocation even for large responses.
This commit is contained in:
Unknown W. Brackets committed 2018-06-08 06:59:17 -07:00
1 parent e746a2d106
commit ccea863f00
7 files changed
+36 -3

No files matched your search

+10 -1
View File
@@ -32,12 +32,21 @@ JsonWriter &DebuggerRequest::Respond() {
void DebuggerRequest::Finish() {
if (responseBegun_ && !responseSent_) {
writer_.end();
ws->Send(writer_.str());
if (responsePartial_)
ws->AddFragment(true, writer_.str());
else
ws->Send(writer_.str());
responseBegun_ = false;
responseSent_ = true;
responsePartial_ = false;
}
}
void DebuggerRequest::Flush() {
ws->AddFragment(false, writer_.flush());
responsePartial_ = true;
}
static bool U32FromString(const char *str, uint32_t *out, bool allowFloat) {
if (TryParse(str, out))
return true;