0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 23:10:54 +01:00

modules/s_dns_resolver: Queue tags when no nameserver is available.

This commit is contained in:
Jason Volk 2019-03-11 11:51:02 -07:00
parent 499d9c7c6e
commit 9930d2ce8f

View file

@ -181,7 +181,7 @@ try
tags.at(next) tags.at(next)
}; };
send_query(tag); submit(tag);
} }
catch(const std::out_of_range &e) catch(const std::out_of_range &e)
{ {
@ -422,7 +422,19 @@ ircd::net::dns::resolver::queue_query(tag &tag)
void void
ircd::net::dns::resolver::submit(tag &tag) ircd::net::dns::resolver::submit(tag &tag)
{ {
assert(ns.is_open()); if(!ns.is_open() || server.empty())
{
log::warning
{
net::log, "dns tag:%u submit queued because no nameserver is available.",
tag.id
};
queue_query(tag);
return;
}
assert(!server.empty());
const auto rate(milliseconds(send_rate) / server.size()); const auto rate(milliseconds(send_rate) / server.size());
const auto elapsed(now<steady_point>() - send_last); const auto elapsed(now<steady_point>() - send_last);
if(elapsed >= rate || tags.size() < size_t(send_burst)) if(elapsed >= rate || tags.size() < size_t(send_burst))
@ -469,6 +481,7 @@ void
ircd::net::dns::resolver::send_query(const ip::udp::endpoint &ep, ircd::net::dns::resolver::send_query(const ip::udp::endpoint &ep,
tag &tag) tag &tag)
{ {
assert(ns.is_open());
assert(ns.non_blocking()); assert(ns.non_blocking());
assert(!empty(tag.question)); assert(!empty(tag.question));
const const_buffer &buf{tag.question}; const const_buffer &buf{tag.question};