From f8e74fbc36bc81ec73afa9e52a3e99bf2f193ab4 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 4 Oct 2019 15:06:49 -0700 Subject: [PATCH] ircd::m::homeserver: Fix remaining module init for now. --- matrix/homeserver.cc | 9 ++++++--- matrix/matrix.cc | 14 ++------------ modules/console.cc | 5 +++-- modules/net_dns_cache.cc | 12 ++++++------ 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/matrix/homeserver.cc b/matrix/homeserver.cc index 657d7bd0e..e67c77d50 100644 --- a/matrix/homeserver.cc +++ b/matrix/homeserver.cc @@ -225,17 +225,20 @@ ircd::m::homeserver::homeserver(const struct opts *const &opts) std::make_shared() } { - if(primary == this && dbs::events && sequence(*dbs::events) == 0) - bootstrap(*this); - if(primary == this && conf) conf->load(); + if(primary == this && dbs::events && sequence(*dbs::events) == 0) + bootstrap(*this); + if(key && !key->verify_keys.empty()) m::keys::cache::set(key->verify_keys); signon(*this); + if(primary == this) + mods::imports.emplace("net_dns"s, "net_dns"s); + if(primary == this) m::init::backfill::init(); } diff --git a/matrix/matrix.cc b/matrix/matrix.cc index 6d69b9a74..41bf701bf 100644 --- a/matrix/matrix.cc +++ b/matrix/matrix.cc @@ -35,8 +35,6 @@ IRCD_MODULE_EXPORT_DATA decltype(ircd::m::matrix::module_names) ircd::m::matrix::module_names { - "net_dns", - "media_media", "well_known", @@ -171,9 +169,6 @@ ircd::m::matrix::module_names_optional /// --- tmp --- -extern "C" void -reload_conf(); - namespace ircd::m::init { struct modules; @@ -181,7 +176,6 @@ namespace ircd::m::init namespace ircd::m { - std::unique_ptr _dbs; std::unique_ptr _fetch; //std::unique_ptr _modules; } @@ -193,10 +187,7 @@ ircd::m::on_load() try { assert(ircd::run::level == run::level::IDLE); - //reload_conf(); _fetch = std::make_unique(); - //_modules = std::make_unique(); - //self::signon(); } catch(const m::error &e) { @@ -225,13 +216,12 @@ void ircd::m::on_unload() noexcept try { - //mods::imports.erase("m_listen"s); if(m::sync::pool.size()) m::sync::pool.join(); - //self::signoff(); _fetch.reset(nullptr); - //_modules.reset(nullptr); + + mods::imports.erase("net_dns"s); //TODO: remove this for non-interfering shutdown //server::interrupt_all(); diff --git a/modules/console.cc b/modules/console.cc index ebf917d0c..a4831f49e 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -2097,9 +2097,10 @@ console_cmd__mod__reload(opt &out, const string_view &line) { const auto &name{*it}; if(mods::imports.erase(std::string{name})) + { out << name << " unloaded." << std::endl; - else - out << name << " is not loaded." << std::endl; + break; + } } for(auto it(names.rbegin()); it != names.rend(); ++it) diff --git a/modules/net_dns_cache.cc b/modules/net_dns_cache.cc index acf34ac96..866b4b0ed 100644 --- a/modules/net_dns_cache.cc +++ b/modules/net_dns_cache.cc @@ -676,20 +676,20 @@ ircd::net::dns::cache::waiter::waiter(const hostport &hp, // cache room creation // -namespace ircd::net::dns { -namespace [[gnu::visibility("hidden")]] cache +namespace ircd::net::dns::cache { static void create_room(); + extern m::hookfn create_room_hook; -}} +} decltype(ircd::net::dns::cache::create_room_hook) ircd::net::dns::cache::create_room_hook { { - { "_site", "vm.effect" }, - { "room_id", "!ircd" }, - { "type", "m.room.create" }, + { "_site", "vm.effect" }, + { "room_id", "!ircd" }, + { "type", "m.room.create" }, }, [](const m::event &, m::vm::eval &) {