X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Futils.cpp;h=3c4d32c29ac0402e3f61a9a3b2cc6d2b049d2953;hb=bc9352391f179dbe2a325ff36b00930c886ef1b3;hp=48d829f6f3cc78b943acb4d53ada4b0fecb25574;hpb=f1712e6f0b58098250791ffc60815fa3fc462607;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 48d829f6f..3c4d32c29 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -2,8 +2,8 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see * the file COPYING for details. @@ -154,24 +154,7 @@ SpanningTreeUtilities::SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningT ServerInstance->Logs->Log("m_spanningtree",DEBUG,"***** Using SID for hash: %s *****", ServerInstance->Config->GetSID().c_str()); 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->ServerUser = new FakeUser(ServerInstance, TreeRoot->GetID()); this->ReadConfiguration(true); } @@ -194,6 +177,7 @@ SpanningTreeUtilities::~SpanningTreeUtilities() } } delete TreeRoot; + delete ServerUser; ServerInstance->BufferedSocketCull(); } @@ -449,6 +433,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++) @@ -536,7 +544,9 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) } - L.NextConnectTime = time(NULL) + L.AutoConnect; + // Fix: Only trip autoconnects if this wouldn't delay autoconnect.. + if (L.NextConnectTime > ((time_t)(ServerInstance->Time() + L.AutoConnect))) + L.NextConnectTime = ServerInstance->Time() + L.AutoConnect; if (L.Name.find('.') == std::string::npos) throw CoreException("The link name '"+assign(L.Name)+"' is invalid and must contain at least one '.' character"); @@ -654,7 +664,7 @@ void SpanningTreeUtilities::DoFailOver(Link* x) Link* SpanningTreeUtilities::FindLink(const std::string& name) { - for (std::vector::iterator x = LinkBlocks.begin(); x < LinkBlocks.end(); x++) + for (std::vector::iterator x = LinkBlocks.begin(); x != LinkBlocks.end(); x++) { if (InspIRCd::Match(x->Name.c_str(), name.c_str())) {