0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-04 17:48:35 +02:00

ircd::net::dns: Add static fire-and-forget callbacks for prefetching.

This commit is contained in:
Jason Volk 2018-04-14 16:20:21 -07:00
parent e3b97871f9
commit cf22eacfd3
2 changed files with 26 additions and 0 deletions

View file

@ -45,6 +45,11 @@ struct ircd::net::dns
bool query_cache(const hostport &, const opts &, const callback &);
public:
// Cache warming
static const callback_A_one prefetch_A;
static const callback_SRV_one prefetch_SRV;
static const callback_ipport_one prefetch_ipport;
// Callback-based interface
void operator()(const hostport &, const opts &, callback);
void operator()(const hostport &, const opts &, callback_A_one);

View file

@ -2308,6 +2308,27 @@ ircd::net::dns::cache::clear_nxdomain
{ "default", 43200L },
};
decltype(ircd::net::dns::prefetch_ipport)
ircd::net::dns::prefetch_ipport{[]
(std::exception_ptr, const auto &record)
{
// Do nothing; cache already updated if necessary
}};
decltype(ircd::net::dns::prefetch_SRV)
ircd::net::dns::prefetch_SRV{[]
(std::exception_ptr, const auto &record)
{
// Do nothing; cache already updated if necessary
}};
decltype(ircd::net::dns::prefetch_A)
ircd::net::dns::prefetch_A{[]
(std::exception_ptr, const auto &record)
{
// Do nothing; cache already updated if necessary
}};
/// Convenience composition with a single ipport callback. This is the result of
/// an automatic chain of queries such as SRV and A/AAAA based on the input and
/// intermediate results.