0
0
Fork 0
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:
Jason Volk 2019-03-22 10:43:31 -07:00
parent 12744182c2
commit eee620df3e

View file

@ -160,16 +160,28 @@ ircd::net::dns::resolve(const hostport &hp,
if(cache::get(hp, opts, cb)) if(cache::get(hp, opts, cb))
return; return;
waiting.emplace_front([cb(std::move(cb)), opts, h(std::string(host(hp)))] auto key
(const string_view &type, const string_view &key, const json::array &rrs) {
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)) if(type != rfc1035::rqtype.at(opts.qtype))
return false; return false;
if(cache::get(hostport(h), opts, cb)) if(state_key != key)
return true; 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; return true;
}); });