0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 04:08:54 +02:00

modules/federation/backfill_ids: Chunk direct to socket.

This commit is contained in:
Jason Volk 2018-04-30 10:38:00 -07:00
parent 7e96e00184
commit 87f792b8eb

View file

@ -85,14 +85,23 @@ get__backfill_ids(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
{ {
512 * limit //TODO: XXX 4_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
{ {
@ -107,15 +116,8 @@ get__backfill_ids(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.event_id()); pdus.append(it.event_id());
}
return resource::response return {};
{
client, json::object
{
out.completed()
}
};
} }
resource::method resource::method