0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 16:34:13 +01:00

modules/client/sync: Use resource::response buffer w/ passed size argument.

This commit is contained in:
Jason Volk 2019-02-26 17:33:16 -08:00
parent cc586a352e
commit a263b2ff40

View file

@ -110,22 +110,15 @@ ircd::m::sync::handle_get(client &client,
args.filter_id args.filter_id
}; };
// Setup an output buffer to compose the response. This has to be at least
// the worst-case size of a matrix event (64_KiB) or bad things happen.
const unique_buffer<mutable_buffer> buffer
{
size_t(buffer_size)
};
// Start the chunked encoded response. // Start the chunked encoded response.
resource::response::chunked response resource::response::chunked response
{ {
client, http::OK, 0 client, http::OK, buffer_size
}; };
json::stack out json::stack out
{ {
buffer, response.buf,
std::bind(&sync::flush, std::ref(data), std::ref(response), ph::_1), std::bind(&sync::flush, std::ref(data), std::ref(response), ph::_1),
size_t(flush_hiwat) size_t(flush_hiwat)
}; };