0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 23:10:54 +01: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,14 +85,23 @@ get__backfill(client &client,
room_id, event_id room_id, event_id
}; };
//TODO: chunk direct to socket
const unique_buffer<mutable_buffer> buf const unique_buffer<mutable_buffer> buf
{ {
64_KiB * limit //TODO: XXX 96_KiB
}; };
json::stack out{buf}; resource::response::chunked response
{ {
client, http::OK
};
json::stack out{buf, [&response]
(const const_buffer &buf)
{
response.write(buf);
return buf;
}};
json::stack::object top{out}; json::stack::object top{out};
json::stack::member pdus_m json::stack::member pdus_m
{ {
@ -106,19 +115,9 @@ get__backfill(client &client,
size_t count{0}; size_t count{0};
for(; it && count < limit; ++count, --it) for(; it && count < limit; ++count, --it)
{ pdus.append(*it);
const m::event &event{*it};
pdus.append(event);
}
}
return resource::response return {};
{
client, json::object
{
out.completed()
}
};
} }
resource::method resource::method