0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 07:23:53 +01:00

ircd: Move any externally used interfaces out of init objects.

This commit is contained in:
Jason Volk 2022-05-26 13:11:35 -07:00
parent e51b855f2b
commit 4821f6d2db
6 changed files with 21 additions and 12 deletions

View file

@ -75,6 +75,9 @@ namespace ircd::db
// Paths of available databases.
std::vector<std::string> available();
//XXX should remove
void chdir();
}
namespace ircd

View file

@ -59,6 +59,11 @@ namespace ircd::server
peer &get(const net::hostport &); // creates the peer if not found.
bool prelink(const net::hostport &); // creates and links if not errant.
bool errclear(const net::hostport &); // clear cached error.
// manual control panel
void interrupt();
void close();
void wait();
}
/// Subsystem initialization / destruction from ircd::main
@ -66,11 +71,6 @@ namespace ircd::server
struct [[gnu::visibility("hidden")]]
ircd::server::init
{
// manual control panel
static void interrupt();
static void close();
static void wait();
init() noexcept;
~init() noexcept;
};

View file

@ -5349,6 +5349,12 @@ ircd::db::make_opts(const sopts &opts)
//
//
void
ircd::db::chdir()
{
init::directory();
}
std::vector<std::string>
ircd::db::available()
{

View file

@ -73,7 +73,7 @@ noexcept
}
void
ircd::server::init::wait()
ircd::server::wait()
{
static const auto finished
{
@ -106,7 +106,7 @@ ircd::server::init::wait()
}
void
ircd::server::init::close()
ircd::server::close()
{
log::debug
{
@ -121,7 +121,7 @@ ircd::server::init::close()
}
void
ircd::server::init::interrupt()
ircd::server::interrupt()
{
log::debug
{

View file

@ -107,7 +107,7 @@ ircd::m::dbs::init::init(const string_view &servername,
fs::base::db.set(our_dbpath);
// Recall the db directory init manually with the now-updated basepath
db::init::directory();
db::chdir();
// Open the events database
static const string_view &dbname{"events"};

View file

@ -305,13 +305,13 @@ ircd::m::homeserver::~homeserver()
noexcept try
{
///TODO: XXX primary
server::init::interrupt();
server::interrupt();
client::terminate_all(); //TODO: XXX
server::init::close();
server::close();
client::close_all();
m::init::backfill::fini();
client::wait_all();
server::init::wait();
server::wait();
m::sync::pool.join();
if(!ircd::maintenance && _vm)