0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-30 17:34:04 +01:00

ircd::net: Improve dns::resolver instance init/fini.

This commit is contained in:
Jason Volk 2018-04-28 15:31:07 -07:00
parent 0f161f98e8
commit 48abece29b
2 changed files with 9 additions and 2 deletions

View file

@ -67,6 +67,8 @@ namespace ircd
struct ircd::net::init
{
std::unique_ptr<struct dns::resolver> resolver;
init();
~init() noexcept;
};

View file

@ -33,10 +33,14 @@ ircd::net::wait_close_sockets()
/// Network subsystem initialization
ircd::net::init::init()
:resolver
{
std::make_unique<struct dns::resolver>()
}
{
assert(ircd::ios);
assert(!net::dns::resolver);
net::dns::resolver = new struct dns::resolver();
dns::resolver = resolver.get();
sslv23_client.set_verify_mode(asio::ssl::verify_peer);
sslv23_client.set_default_verify_paths();
@ -44,9 +48,10 @@ ircd::net::init::init()
/// Network subsystem shutdown
ircd::net::init::~init()
noexcept
{
wait_close_sockets();
delete net::dns::resolver;
assert(net::dns::resolver == resolver.get());
net::dns::resolver = nullptr;
}