mirror of
https://github.com/matrix-construct/construct
synced 2024-09-29 04:08:54 +02:00
modules/federation/backfill: Chunk direct to socket.
This commit is contained in:
parent
8daa14c2b1
commit
4a25f3be72
1 changed files with 27 additions and 28 deletions
|
@ -85,14 +85,23 @@ 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
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -106,19 +115,9 @@ get__backfill(client &client,
|
|||
|
||||
size_t count{0};
|
||||
for(; it && count < limit; ++count, --it)
|
||||
{
|
||||
const m::event &event{*it};
|
||||
pdus.append(event);
|
||||
}
|
||||
}
|
||||
pdus.append(*it);
|
||||
|
||||
return resource::response
|
||||
{
|
||||
client, json::object
|
||||
{
|
||||
out.completed()
|
||||
}
|
||||
};
|
||||
return {};
|
||||
}
|
||||
|
||||
resource::method
|
||||
|
|
Loading…
Reference in a new issue