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:
parent
e3b97871f9
commit
cf22eacfd3
|
@ -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);
|
||||
|
|
21
ircd/net.cc
21
ircd/net.cc
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue