summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-05 11:19:35 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-05 11:19:35 +0000
commit17ba341f7160c78e82ca6d71639d27ab0fa58b85 (patch)
tree0ec21b7e54489a599a9c4268fc7402a40abc6914
parent38a6bca73ce34091f0f456eb866e9cf9452d89c7 (diff)
Remove VF_STATIC from spanningtree and make a clever destructor to close and free all its open sockets. In theory this will make insp split from everything neatly when you unload spanningtree.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5418 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_spanningtree.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 4138d3827..0a04708e1 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -4997,11 +4997,33 @@ class ModuleSpanningTree : public Module
virtual ~ModuleSpanningTree()
{
+ ServerInstance->Log(DEBUG,"Performing unload of spanningtree!");
+ ServerInstance->Log(DEBUG,"Freeing bindings...");
+ for (unsigned int i = 0; i < Bindings.size(); i++)
+ {
+ ServerInstance->Log(DEBUG,"Freeing binding %d of %d",i, Bindings.size());
+ ServerInstance->SE->DelFd(Bindings[i]);
+ Bindings[i]->Close();
+ DELETE(Bindings[i]);
+ }
+ ServerInstance->Log(DEBUG,"Freeing connected servers...");
+ while (TreeRoot->ChildCount())
+ {
+ TreeServer* child_server = TreeRoot->GetChild(0);
+ ServerInstance->Log(DEBUG,"Freeing connected server %s", child_server->GetName().c_str());
+ if (child_server)
+ {
+ TreeSocket* sock = child_server->GetSocket();
+ ServerInstance->SE->DelFd(sock);
+ sock->Close();
+ DELETE(sock);
+ }
+ }
}
virtual Version GetVersion()
{
- return Version(1,1,0,2,VF_STATIC|VF_VENDOR,API_VERSION);
+ return Version(1,1,0,2,VF_VENDOR,API_VERSION);
}
void Implements(char* List)