0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-09 21:48:55 +02:00

ircd:Ⓜ️:feds: Add an exclude_myself option.

This commit is contained in:
Jason Volk 2019-08-14 01:51:38 -07:00
parent 3d808022ed
commit 1c42206307
2 changed files with 11 additions and 0 deletions

View file

@ -93,6 +93,11 @@ struct ircd::m::feds::opts
/// the user's closure is never invoked and no request is made if a remote
/// has a cached error.
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

View file

@ -460,6 +460,9 @@ ircd::m::feds::for_each_in_room(const opts &opts,
origins.for_each([&opts, &ret, &closure, &create_closure]
(const string_view &origin)
{
if(opts.exclude_myself && my_host(origin))
return;
const auto errmsg
{
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)
{
request_list ret;
if(opts.exclude_myself && my_host(origin))
return ret;
const auto errmsg
{
server::errmsg(origin)