summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-30 17:12:08 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-30 17:12:08 +0000
commit4a64082e31c3c3dfa97a1edfb8a3c97fe8d32ea7 (patch)
treeabe1f2293fae907540a1feb609b4b2a5888616af /src/modules/m_spanningtree
parent5fd6471070ecf0f9a0074714c57211e922257014 (diff)
Move destruction logic for User and Spanningtree into cull()
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11783 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/main.cpp5
-rw-r--r--src/modules/m_spanningtree/main.h1
-rw-r--r--src/modules/m_spanningtree/utils.cpp18
-rw-r--r--src/modules/m_spanningtree/utils.h4
4 files changed, 23 insertions, 5 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index e3ed9fca2..db40c7f6a 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -939,6 +939,11 @@ void ModuleSpanningTree::OnEvent(Event* event)
}
}
+void ModuleSpanningTree::cull()
+{
+ Utils->cull();
+}
+
ModuleSpanningTree::~ModuleSpanningTree()
{
delete ServerInstance->PI;
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 810b8ec92..6e3f62056 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -191,6 +191,7 @@ class ModuleSpanningTree : public Module
void OnEvent(Event* event);
void OnLoadModule(Module* mod,const std::string &name);
void OnUnloadModule(Module* mod,const std::string &name);
+ void cull();
~ModuleSpanningTree();
Version GetVersion();
void Prioritize();
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 729f6d4ee..fc5356c66 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -157,11 +157,11 @@ SpanningTreeUtilities::SpanningTreeUtilities(ModuleSpanningTree* C) : Creator(C)
this->ReadConfiguration(true);
}
-SpanningTreeUtilities::~SpanningTreeUtilities()
+void SpanningTreeUtilities::cull()
{
for (unsigned int i = 0; i < Bindings.size(); i++)
{
- delete Bindings[i];
+ Bindings[i]->cull();
}
while (TreeRoot->ChildCount())
@@ -170,13 +170,21 @@ SpanningTreeUtilities::~SpanningTreeUtilities()
if (child_server)
{
TreeSocket* sock = child_server->GetSocket();
- ServerInstance->SE->DelFd(sock);
sock->Close();
}
}
-
- // This avoids a collision on reload
+
ServerUser->uuid = TreeRoot->GetID();
+ ServerUser->cull();
+}
+
+SpanningTreeUtilities::~SpanningTreeUtilities()
+{
+ for (unsigned int i = 0; i < Bindings.size(); i++)
+ {
+ delete Bindings[i];
+ }
+
delete TreeRoot;
delete ServerUser;
}
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 2f8fc75db..1de6de076 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -164,6 +164,10 @@ class SpanningTreeUtilities : public classbase
*/
SpanningTreeUtilities(ModuleSpanningTree* Creator);
+ /** Prepare for class destruction
+ */
+ void cull();
+
/** Destroy class and free listeners etc
*/
~SpanningTreeUtilities();