mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd::net::dns::cache: Add equality operations for waiter.
This commit is contained in:
parent
3157aa5405
commit
d3039669f5
2 changed files with 22 additions and 2 deletions
|
@ -129,8 +129,7 @@ ircd::net::dns::resolve(const hostport &hp,
|
|||
std::count_if(begin(cache::waiting), end(cache::waiting), []
|
||||
(const auto &a)
|
||||
{
|
||||
const auto &b(cache::waiting.back());
|
||||
return a.opts.qtype == b.opts.qtype && a.key == b.key;
|
||||
return a == cache::waiting.back();
|
||||
})
|
||||
};
|
||||
|
||||
|
@ -968,6 +967,24 @@ catch(const std::exception &e)
|
|||
// cache::waiter
|
||||
//
|
||||
|
||||
bool
|
||||
ircd::net::dns::cache::operator==(const waiter &a, const waiter &b)
|
||||
{
|
||||
return a.opts.qtype == b.opts.qtype &&
|
||||
a.key && b.key &&
|
||||
a.key == b.key;
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::net::dns::cache::operator!=(const waiter &a, const waiter &b)
|
||||
{
|
||||
return !operator==(a, b);
|
||||
}
|
||||
|
||||
//
|
||||
// cache::waiter::waiter
|
||||
//
|
||||
|
||||
ircd::net::dns::cache::waiter::waiter(const hostport &hp,
|
||||
const dns::opts &opts,
|
||||
dns::callback &&callback)
|
||||
|
|
|
@ -37,6 +37,9 @@ namespace ircd::net::dns::cache
|
|||
{
|
||||
struct waiter;
|
||||
|
||||
static bool operator==(const waiter &, const waiter &);
|
||||
static bool operator!=(const waiter &, const waiter &);
|
||||
|
||||
static bool call_waiter(const string_view &, const string_view &, const json::array &, waiter &);
|
||||
static size_t call_waiters(const string_view &, const string_view &, const json::array &);
|
||||
static void handle(const m::event &, m::vm::eval &);
|
||||
|
|
Loading…
Reference in a new issue