0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 19:58:53 +02:00

modules/federation/backfill: Chunk direct to socket.

This commit is contained in:
Jason Volk 2018-04-30 10:25:44 -07:00
parent 8daa14c2b1
commit 4a25f3be72

View file

@ -85,40 +85,39 @@ get__backfill(client &client,
room_id, event_id
};
//TODO: chunk direct to socket
const unique_buffer<mutable_buffer> buf
{
64_KiB * limit //TODO: XXX
96_KiB
};
json::stack out{buf};
resource::response::chunked response
{
json::stack::object top{out};
json::stack::member pdus_m
{
top, "pdus"
};
json::stack::array pdus
{
pdus_m
};
size_t count{0};
for(; it && count < limit; ++count, --it)
{
const m::event &event{*it};
pdus.append(event);
}
}
return resource::response
{
client, json::object
{
out.completed()
}
client, http::OK
};
json::stack out{buf, [&response]
(const const_buffer &buf)
{
response.write(buf);
return buf;
}};
json::stack::object top{out};
json::stack::member pdus_m
{
top, "pdus"
};
json::stack::array pdus
{
pdus_m
};
size_t count{0};
for(; it && count < limit; ++count, --it)
pdus.append(*it);
return {};
}
resource::method