mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd:Ⓜ️:homeserver: Consolidate legacy shutdown procedure on primary dtor for now.
This commit is contained in:
parent
1c305257af
commit
e27dd573ad
2 changed files with 34 additions and 31 deletions
|
@ -161,6 +161,15 @@ ircd::m::origin(const homeserver &homeserver)
|
|||
// homeserver::homeserver
|
||||
//
|
||||
|
||||
/// --- tmp ---
|
||||
|
||||
namespace ircd::m
|
||||
{
|
||||
std::unique_ptr<fetch::init> _fetch;
|
||||
}
|
||||
|
||||
/// --- /tmp ---
|
||||
|
||||
decltype(ircd::m::homeserver::primary)
|
||||
ircd::m::homeserver::primary;
|
||||
|
||||
|
@ -172,6 +181,11 @@ try
|
|||
assert(opts);
|
||||
rfc3986::valid_host(opts->origin);
|
||||
rfc3986::valid_host(opts->server_name);
|
||||
|
||||
//TODO: XXX
|
||||
if(!_fetch)
|
||||
_fetch = std::make_unique<fetch::init>();
|
||||
|
||||
return new homeserver
|
||||
{
|
||||
opts
|
||||
|
@ -262,14 +276,30 @@ ircd::m::homeserver::~homeserver()
|
|||
noexcept
|
||||
{
|
||||
if(primary == this)
|
||||
m::init::backfill::fini();
|
||||
|
||||
signoff(*this);
|
||||
vm.reset();
|
||||
{
|
||||
//TODO: remove this for non-interfering shutdown
|
||||
server::init::interrupt();
|
||||
client::terminate_all();
|
||||
server::init::close();
|
||||
client::close_all();
|
||||
client::wait_all();
|
||||
server::init::wait();
|
||||
}
|
||||
|
||||
if(primary == this)
|
||||
{
|
||||
m::init::backfill::fini();
|
||||
m::sync::pool.join();
|
||||
}
|
||||
|
||||
signoff(*this);
|
||||
if(primary == this)
|
||||
mods::imports.erase("net_dns_cache"s);
|
||||
|
||||
vm.reset();
|
||||
if(primary == this)
|
||||
_fetch.reset(nullptr);
|
||||
|
||||
while(!modules.empty())
|
||||
modules.pop_back();
|
||||
}
|
||||
|
|
|
@ -163,27 +163,11 @@ ircd::m::matrix::module_names_optional
|
|||
// init
|
||||
//
|
||||
|
||||
/// --- tmp ---
|
||||
|
||||
namespace ircd::m::init
|
||||
{
|
||||
struct modules;
|
||||
}
|
||||
|
||||
namespace ircd::m
|
||||
{
|
||||
std::unique_ptr<fetch::init> _fetch;
|
||||
//std::unique_ptr<init::modules> _modules;
|
||||
}
|
||||
|
||||
/// --- /tmp ---
|
||||
|
||||
void
|
||||
ircd::m::on_load()
|
||||
try
|
||||
{
|
||||
assert(ircd::run::level == run::level::IDLE);
|
||||
_fetch = std::make_unique<fetch::init>();
|
||||
}
|
||||
catch(const m::error &e)
|
||||
{
|
||||
|
@ -221,18 +205,7 @@ void
|
|||
ircd::m::on_unload()
|
||||
noexcept try
|
||||
{
|
||||
if(m::sync::pool.size())
|
||||
m::sync::pool.join();
|
||||
|
||||
_fetch.reset(nullptr);
|
||||
|
||||
//TODO: remove this for non-interfering shutdown
|
||||
//server::interrupt_all();
|
||||
//client::terminate_all();
|
||||
//client::close_all();
|
||||
//server::close_all();
|
||||
//server::wait_all();
|
||||
//client::wait_all();
|
||||
}
|
||||
catch(const m::error &e)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue