0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 23:40:57 +01:00

modules/client/keys: Add limits on dynamic buffer calculations.

This commit is contained in:
Jason Volk 2020-04-27 13:26:04 -07:00
parent a14dcc325f
commit 12d4b6b53e
2 changed files with 16 additions and 2 deletions

View file

@ -118,6 +118,13 @@ claim_timeout_max
{ "default", 30000L },
};
conf::item<size_t>
claim_limit
{
{ "name", "ircd.client.keys.claim.limit" },
{ "default", 4096L },
};
m::resource::response
post__keys_claim(client &client,
const m::resource::request &request)
@ -281,7 +288,7 @@ try
static_assert(is_powerof2(buffer_unit_size));
const size_t buffer_size
{
buffer_unit_size * queries.size()
buffer_unit_size * std::min(queries.size(), size_t(claim_limit))
};
const auto &buffer

View file

@ -117,6 +117,13 @@ query_timeout_max
{ "default", 20000L },
};
conf::item<size_t>
query_limit
{
{ "name", "ircd.client.keys.query.limit" },
{ "default", 4096L },
};
m::resource::response
post__keys_query(client &client,
const m::resource::request &request)
@ -330,7 +337,7 @@ try
const size_t buffer_size
{
buffer_unit_size * queries.size()
buffer_unit_size * std::min(queries.size(), size_t(query_limit))
};
const auto &buffer