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:
parent
a14dcc325f
commit
12d4b6b53e
2 changed files with 16 additions and 2 deletions
|
@ -118,6 +118,13 @@ claim_timeout_max
|
||||||
{ "default", 30000L },
|
{ "default", 30000L },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
conf::item<size_t>
|
||||||
|
claim_limit
|
||||||
|
{
|
||||||
|
{ "name", "ircd.client.keys.claim.limit" },
|
||||||
|
{ "default", 4096L },
|
||||||
|
};
|
||||||
|
|
||||||
m::resource::response
|
m::resource::response
|
||||||
post__keys_claim(client &client,
|
post__keys_claim(client &client,
|
||||||
const m::resource::request &request)
|
const m::resource::request &request)
|
||||||
|
@ -281,7 +288,7 @@ try
|
||||||
static_assert(is_powerof2(buffer_unit_size));
|
static_assert(is_powerof2(buffer_unit_size));
|
||||||
const size_t buffer_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
|
const auto &buffer
|
||||||
|
|
|
@ -117,6 +117,13 @@ query_timeout_max
|
||||||
{ "default", 20000L },
|
{ "default", 20000L },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
conf::item<size_t>
|
||||||
|
query_limit
|
||||||
|
{
|
||||||
|
{ "name", "ircd.client.keys.query.limit" },
|
||||||
|
{ "default", 4096L },
|
||||||
|
};
|
||||||
|
|
||||||
m::resource::response
|
m::resource::response
|
||||||
post__keys_query(client &client,
|
post__keys_query(client &client,
|
||||||
const m::resource::request &request)
|
const m::resource::request &request)
|
||||||
|
@ -330,7 +337,7 @@ try
|
||||||
|
|
||||||
const size_t buffer_size
|
const size_t buffer_size
|
||||||
{
|
{
|
||||||
buffer_unit_size * queries.size()
|
buffer_unit_size * std::min(queries.size(), size_t(query_limit))
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto &buffer
|
const auto &buffer
|
||||||
|
|
Loading…
Reference in a new issue