mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
modules/s_dns_resolver: Queue tags when no nameserver is available.
This commit is contained in:
parent
499d9c7c6e
commit
9930d2ce8f
1 changed files with 15 additions and 2 deletions
|
@ -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};
|
||||||
|
|
Loading…
Reference in a new issue