mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
modules/s_dns: Fix keying for response matching.
This commit is contained in:
parent
12744182c2
commit
eee620df3e
1 changed files with 17 additions and 5 deletions
|
@ -160,16 +160,28 @@ ircd::net::dns::resolve(const hostport &hp,
|
|||
if(cache::get(hp, opts, cb))
|
||||
return;
|
||||
|
||||
waiting.emplace_front([cb(std::move(cb)), opts, h(std::string(host(hp)))]
|
||||
(const string_view &type, const string_view &key, const json::array &rrs)
|
||||
auto key
|
||||
{
|
||||
opts.qtype == 33?
|
||||
ircd::string_buffer(rfc1035::NAME_BUF_SIZE*2, make_SRV_key, hp, opts):
|
||||
std::string(host(hp))
|
||||
};
|
||||
|
||||
waiting.emplace_front([cb(std::move(cb)), opts, key(std::move(key)), port(net::port(hp))]
|
||||
(const string_view &type, const string_view &state_key, const json::array &rrs)
|
||||
{
|
||||
if(type != rfc1035::rqtype.at(opts.qtype))
|
||||
return false;
|
||||
|
||||
if(cache::get(hostport(h), opts, cb))
|
||||
return true;
|
||||
if(state_key != key)
|
||||
return false;
|
||||
|
||||
cb(hostport(h), rrs);
|
||||
const hostport &hp
|
||||
{
|
||||
opts.qtype == 33? unmake_SRV_key(state_key): state_key, port
|
||||
};
|
||||
|
||||
cb(hp, rrs);
|
||||
return true;
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue