From 4821f6d2dbd509849ea1b06fd4cc639b49e00710 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 26 May 2022 13:11:35 -0700 Subject: [PATCH] ircd: Move any externally used interfaces out of init objects. --- include/ircd/db/db.h | 3 +++ include/ircd/server/server.h | 10 +++++----- ircd/db.cc | 6 ++++++ ircd/server.cc | 6 +++--- matrix/dbs.cc | 2 +- matrix/homeserver.cc | 6 +++--- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/include/ircd/db/db.h b/include/ircd/db/db.h index 794ef6070..41fa89e4a 100644 --- a/include/ircd/db/db.h +++ b/include/ircd/db/db.h @@ -75,6 +75,9 @@ namespace ircd::db // Paths of available databases. std::vector available(); + + //XXX should remove + void chdir(); } namespace ircd diff --git a/include/ircd/server/server.h b/include/ircd/server/server.h index cedec24cf..222ec5557 100644 --- a/include/ircd/server/server.h +++ b/include/ircd/server/server.h @@ -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; }; diff --git a/ircd/db.cc b/ircd/db.cc index b5eda0d59..c3df66502 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -5349,6 +5349,12 @@ ircd::db::make_opts(const sopts &opts) // // +void +ircd::db::chdir() +{ + init::directory(); +} + std::vector ircd::db::available() { diff --git a/ircd/server.cc b/ircd/server.cc index 48cb98aa4..6613a8b57 100644 --- a/ircd/server.cc +++ b/ircd/server.cc @@ -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 { diff --git a/matrix/dbs.cc b/matrix/dbs.cc index 244daf8a4..72fe861c5 100644 --- a/matrix/dbs.cc +++ b/matrix/dbs.cc @@ -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"}; diff --git a/matrix/homeserver.cc b/matrix/homeserver.cc index 22d3b76fb..b9ad567e9 100644 --- a/matrix/homeserver.cc +++ b/matrix/homeserver.cc @@ -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)