mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 02:02:38 +01:00
ircd::net: Improve dns::resolver instance init/fini.
This commit is contained in:
parent
0f161f98e8
commit
48abece29b
2 changed files with 9 additions and 2 deletions
|
@ -67,6 +67,8 @@ namespace ircd
|
|||
|
||||
struct ircd::net::init
|
||||
{
|
||||
std::unique_ptr<struct dns::resolver> resolver;
|
||||
|
||||
init();
|
||||
~init() noexcept;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue