mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 08:42:34 +01:00
ircd::net::dns::resolver: Wait for all tags before net teardown on fini.
This commit is contained in:
parent
083493dd1c
commit
26cd9cec85
1 changed files with 2 additions and 30 deletions
|
@ -132,37 +132,20 @@ ircd::net::dns::resolver::resolver(answers_callback callback)
|
|||
ircd::net::dns::resolver::~resolver()
|
||||
noexcept
|
||||
{
|
||||
log::debug
|
||||
{
|
||||
log, "Shutting down with %zu unfinished DNS resolutions.",
|
||||
tags.size()
|
||||
};
|
||||
|
||||
const ctx::uninterruptible::nothrow ui;
|
||||
if(ns.is_open())
|
||||
ns.close();
|
||||
|
||||
done.wait([this]
|
||||
{
|
||||
if(!tags.empty())
|
||||
log::warning
|
||||
{
|
||||
log, "Waiting for %zu unfinished DNS resolutions",
|
||||
log, "Waiting for %zu unfinished DNS resolutions...",
|
||||
tags.size()
|
||||
};
|
||||
|
||||
return tags.empty();
|
||||
});
|
||||
|
||||
const std::lock_guard lock
|
||||
{
|
||||
mutex
|
||||
};
|
||||
|
||||
timeout_context.terminate();
|
||||
sendq_context.terminate();
|
||||
recv_context.terminate();
|
||||
|
||||
assert(!mutex.locked());
|
||||
assert(sendq.empty());
|
||||
assert(tags.empty());
|
||||
}
|
||||
|
@ -306,7 +289,6 @@ catch(const std::out_of_range &e)
|
|||
|
||||
void
|
||||
ircd::net::dns::resolver::timeout_worker()
|
||||
try
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
|
@ -318,16 +300,6 @@ try
|
|||
check_timeouts(milliseconds(timeout));
|
||||
}
|
||||
}
|
||||
catch(const ctx::terminated &)
|
||||
{
|
||||
const ctx::exception_handler eh;
|
||||
const std::lock_guard lock
|
||||
{
|
||||
mutex
|
||||
};
|
||||
|
||||
cancel_all();
|
||||
}
|
||||
|
||||
void
|
||||
ircd::net::dns::resolver::check_timeouts(const milliseconds &timeout)
|
||||
|
|
Loading…
Reference in a new issue