diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-01-02 23:15:09 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-01-02 23:15:09 +0000 |
commit | 7fdb199071b8f83860e33d9548f014c54c95fbe2 (patch) | |
tree | 40970e92a2b9b335519999d0efafd2bc71b81c2d /src/modules/m_spanningtree/utils.cpp | |
parent | 0aac6a2b2ac1dca4783c4deeda5fdde031c8a612 (diff) |
If a module is loaded after m_spanningtree that it needs, then it will now re-read its configuration file. The code is also now in the right place to pick this up on rehash too not just on load.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10934 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree/utils.cpp')
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index b9216ca9a..91b8dd239 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -155,24 +155,6 @@ SpanningTreeUtilities::SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningT this->TreeRoot = new TreeServer(this, ServerInstance, ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc, ServerInstance->Config->GetSID()); - modulelist* ml = ServerInstance->Modules->FindInterface("BufferedSocketHook"); - - /* Did we find any modules? */ - if (ml) - { - /* Yes, enumerate them all to find out the hook name */ - for (modulelist::iterator m = ml->begin(); m != ml->end(); m++) - { - /* Make a request to it for its name, its implementing - * BufferedSocketHook so we know its safe to do this - */ - std::string name = BufferedSocketNameRequest((Module*)Creator, *m).Send(); - /* Build a map of them */ - hooks[name.c_str()] = *m; - hooknames.push_back(name); - } - } - this->ReadConfiguration(true); } @@ -449,6 +431,30 @@ void SpanningTreeUtilities::RefreshIPCache() void SpanningTreeUtilities::ReadConfiguration(bool rebind) { ConfigReader* Conf = new ConfigReader(ServerInstance); + + /* We don't need to worry about these being *unloaded* on the fly, only loaded, + * because we 'use' the interface locking the module in memory. + */ + hooks.clear(); + hooknames.clear(); + modulelist* ml = ServerInstance->Modules->FindInterface("BufferedSocketHook"); + + /* Did we find any modules? */ + if (ml) + { + /* Yes, enumerate them all to find out the hook name */ + for (modulelist::iterator m = ml->begin(); m != ml->end(); m++) + { + /* Make a request to it for its name, its implementing + * BufferedSocketHook so we know its safe to do this + */ + std::string name = BufferedSocketNameRequest((Module*)Creator, *m).Send(); + /* Build a map of them */ + hooks[name.c_str()] = *m; + hooknames.push_back(name); + } + } + if (rebind) { for (unsigned int i = 0; i < Bindings.size(); i++) |