summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2019-09-23 11:51:09 +0100
committerPeter Powell <petpow@saberuk.com>2019-09-23 13:18:19 +0100
commitcf5d382b822cecd54fdbc77e4c1c4de8a8aa3c35 (patch)
treef05c9f3c3acfc863dd053abacde791f32fa216f1 /src
parenta4305d8f3c3e613be839bdcd61a1d14c87fed5aa (diff)
Add whether the server split with an error to OnServerSplit.
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_sasl.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp2
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp10
-rw-r--r--src/modules/m_spanningtree/treeserver.h10
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp2
5 files changed, 14 insertions, 12 deletions
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp
index 28bce2bf3..9813ba6b5 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -59,7 +59,7 @@ class ServerTracker
Update(server, true);
}
- void OnServerSplit(const Server* server) CXX11_OVERRIDE
+ void OnServerSplit(const Server* server, bool error) CXX11_OVERRIDE
{
Update(server, false);
}
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 2848ce940..3e992f39f 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -689,7 +689,7 @@ void ModuleSpanningTree::OnUnloadModule(Module* mod)
{
TreeServer* server = i->second;
if (!server->IsRoot())
- FOREACH_MOD_CUSTOM(GetLinkEventProvider(), ServerProtocol::LinkEventListener, OnServerSplit, (server));
+ FOREACH_MOD_CUSTOM(GetLinkEventProvider(), ServerProtocol::LinkEventListener, OnServerSplit, (server, false));
}
return;
}
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index 2b143269c..c463ef1c8 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -172,7 +172,7 @@ void TreeServer::FinishBurst()
FinishBurstInternal();
}
-void TreeServer::SQuitChild(TreeServer* server, const std::string& reason)
+void TreeServer::SQuitChild(TreeServer* server, const std::string& reason, bool error)
{
stdalgo::erase(Children, server);
@@ -188,7 +188,7 @@ void TreeServer::SQuitChild(TreeServer* server, const std::string& reason)
}
unsigned int num_lost_servers = 0;
- server->SQuitInternal(num_lost_servers);
+ server->SQuitInternal(num_lost_servers, error);
const std::string quitreason = GetName() + " " + server->GetName();
unsigned int num_lost_users = QuitUsers(quitreason);
@@ -204,14 +204,14 @@ void TreeServer::SQuitChild(TreeServer* server, const std::string& reason)
ServerInstance->GlobalCulls.AddItem(server);
}
-void TreeServer::SQuitInternal(unsigned int& num_lost_servers)
+void TreeServer::SQuitInternal(unsigned int& num_lost_servers, bool error)
{
ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Server %s lost in split", GetName().c_str());
for (ChildServers::const_iterator i = Children.begin(); i != Children.end(); ++i)
{
TreeServer* server = *i;
- server->SQuitInternal(num_lost_servers);
+ server->SQuitInternal(num_lost_servers, error);
}
// Mark server as dead
@@ -220,7 +220,7 @@ void TreeServer::SQuitInternal(unsigned int& num_lost_servers)
RemoveHash();
if (!Utils->Creator->dying)
- FOREACH_MOD_CUSTOM(Utils->Creator->GetLinkEventProvider(), ServerProtocol::LinkEventListener, OnServerSplit, (this));
+ FOREACH_MOD_CUSTOM(Utils->Creator->GetLinkEventProvider(), ServerProtocol::LinkEventListener, OnServerSplit, (this, error));
}
unsigned int TreeServer::QuitUsers(const std::string& reason)
diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h
index 90841d0b4..14413cd92 100644
--- a/src/modules/m_spanningtree/treeserver.h
+++ b/src/modules/m_spanningtree/treeserver.h
@@ -74,7 +74,7 @@ class TreeServer : public Server
/** Used by SQuit logic to recursively remove servers
*/
- void SQuitInternal(unsigned int& num_lost_servers);
+ void SQuitInternal(unsigned int& num_lost_servers, bool error);
/** Remove the reference to this server from the hash maps
*/
@@ -103,15 +103,17 @@ class TreeServer : public Server
/** SQuit a server connected to this server, removing the given server and all servers behind it
* @param server Server to squit, must be directly below this server
* @param reason Reason for quitting the server, sent to opers and other servers
+ * @param error Whether the server is being squit because of an error.
*/
- void SQuitChild(TreeServer* server, const std::string& reason);
+ void SQuitChild(TreeServer* server, const std::string& reason, bool error = false);
/** SQuit this server, removing this server and all servers behind it
* @param reason Reason for quitting the server, sent to opers and other servers
+ * @param error Whether the server is being squit because of an error.
*/
- void SQuit(const std::string& reason)
+ void SQuit(const std::string& reason, bool error = false)
{
- GetParent()->SQuitChild(this, reason);
+ GetParent()->SQuitChild(this, reason, error);
}
static unsigned int QuitUsers(const std::string& reason);
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 966d624bb..13ede628a 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -415,7 +415,7 @@ void TreeSocket::Close()
// If the connection is fully up (state CONNECTED)
// then propogate a netsplit to all peers.
if (MyRoot)
- MyRoot->SQuit(getError());
+ MyRoot->SQuit(getError(), true);
ServerInstance->SNO->WriteGlobalSno('l', "Connection to '\002%s\002' failed.", linkID.c_str());