mirror of
https://github.com/matrix-construct/construct
synced 2025-01-15 17:16:49 +01:00
ircd:Ⓜ️:feds: Add an exclude_myself option.
This commit is contained in:
parent
3d808022ed
commit
1c42206307
2 changed files with 11 additions and 0 deletions
|
@ -93,6 +93,11 @@ struct ircd::m::feds::opts
|
||||||
/// the user's closure is never invoked and no request is made if a remote
|
/// the user's closure is never invoked and no request is made if a remote
|
||||||
/// has a cached error.
|
/// has a cached error.
|
||||||
bool closure_cached_errors {false};
|
bool closure_cached_errors {false};
|
||||||
|
|
||||||
|
/// Whether to skip any loopback queries to my own host. This is false by
|
||||||
|
/// default, and loopback queries are made for result completeness in the
|
||||||
|
/// typical use case.
|
||||||
|
bool exclude_myself {false};
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ircd::m::feds::op
|
enum class ircd::m::feds::op
|
||||||
|
|
|
@ -460,6 +460,9 @@ ircd::m::feds::for_each_in_room(const opts &opts,
|
||||||
origins.for_each([&opts, &ret, &closure, &create_closure]
|
origins.for_each([&opts, &ret, &closure, &create_closure]
|
||||||
(const string_view &origin)
|
(const string_view &origin)
|
||||||
{
|
{
|
||||||
|
if(opts.exclude_myself && my_host(origin))
|
||||||
|
return;
|
||||||
|
|
||||||
const auto errmsg
|
const auto errmsg
|
||||||
{
|
{
|
||||||
server::errmsg(origin)
|
server::errmsg(origin)
|
||||||
|
@ -498,6 +501,9 @@ ircd::m::feds::for_one(const string_view &origin,
|
||||||
const std::function<T (request<T> &, const string_view &origin)> &create_closure)
|
const std::function<T (request<T> &, const string_view &origin)> &create_closure)
|
||||||
{
|
{
|
||||||
request_list ret;
|
request_list ret;
|
||||||
|
if(opts.exclude_myself && my_host(origin))
|
||||||
|
return ret;
|
||||||
|
|
||||||
const auto errmsg
|
const auto errmsg
|
||||||
{
|
{
|
||||||
server::errmsg(origin)
|
server::errmsg(origin)
|
||||||
|
|
Loading…
Reference in a new issue