summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/main.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-04-26 15:02:50 +0200
committerAttila Molnar <attilamolnar@hush.com>2016-04-26 15:02:50 +0200
commit6cfe4011ec0e90718d7d5a449a5330b8e9a18ec3 (patch)
tree13bdd9ddc821351ff125d0a472416199ca060f42 /src/modules/m_spanningtree/main.cpp
parent53f266a35ff6201d606a4e8f66f0c6cccb630891 (diff)
parent72501adb5c721ac7b8d148c53305457e2c5a5921 (diff)
Merge branch 'master+sasloffline'
Diffstat (limited to 'src/modules/m_spanningtree/main.cpp')
-rw-r--r--src/modules/m_spanningtree/main.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 5b3f9c0bb..0b9bb65df 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -25,6 +25,7 @@
#include "socket.h"
#include "xline.h"
#include "iohook.h"
+#include "modules/spanningtree.h"
#include "resolvers.h"
#include "main.h"
@@ -613,6 +614,21 @@ void ModuleSpanningTree::OnUnloadModule(Module* mod)
return;
ServerInstance->PI->SendMetaData("modules", "-" + mod->ModuleSourceFile);
+ if (mod == this)
+ {
+ // We are being unloaded, inform modules about all servers splitting which cannot be done later when the servers are actually disconnected
+ const server_hash& servers = Utils->serverlist;
+ for (server_hash::const_iterator i = servers.begin(); i != servers.end(); ++i)
+ {
+ TreeServer* server = i->second;
+ if (!server->IsRoot())
+ FOREACH_MOD_CUSTOM(GetEventProvider(), SpanningTreeEventListener, OnServerSplit, (server));
+ }
+ return;
+ }
+
+ // Some other module is being unloaded. If it provides an IOHook we use, we must close that server connection now.
+
restart:
// Close all connections which use an IO hook provided by this module
const TreeServer::ChildServers& list = Utils->TreeRoot->GetChildren();