summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-15 10:43:42 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-15 10:43:42 +0000
commit8409e969b237ad727726afaf3b657ad038ead6b5 (patch)
tree1d5f4f21599d6e8555ba44c5e9200796265d6569 /src
parent87af31adb8eb7780fe202f92833f46990bde1dd2 (diff)
Updated so that netsplits use the cull_list.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2460 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree.cpp35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 65f9bd7e7..a20318d3f 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -40,6 +40,7 @@ using namespace std;
#include "message.h"
#include "xline.h"
#include "typedefs.h"
+#include "cull_list.h"
#ifdef GCC3
#define nspace __gnu_cxx
@@ -645,7 +646,7 @@ class TreeSocket : public InspSocket
* is having a REAL bad hair day, this function shouldnt be called
* too many times a month ;-)
*/
- void SquitServer(TreeServer* Current)
+ void SquitServer(TreeServer* Current, CullList* Goners)
{
/* recursively squit the servers attached to 'Current'.
* We're going backwards so we don't remove users
@@ -654,29 +655,18 @@ class TreeSocket : public InspSocket
for (unsigned int q = 0; q < Current->ChildCount(); q++)
{
TreeServer* recursive_server = Current->GetChild(q);
- this->SquitServer(recursive_server);
+ this->SquitServer(recursive_server,Goners);
}
/* Now we've whacked the kids, whack self */
num_lost_servers++;
- bool quittingpeople = true;
- while (quittingpeople)
- {
- /* Yup i know, "ew". We cant continue to loop through the
- * iterator if we modify it, so whenever we modify it with a
- * QUIT we have to start alllll over again. If anyone knows
- * a better faster way of *safely* doing this, please let me
- * know!
- */
- quittingpeople = false;
- for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++)
+ quittingpeople = false;
+ for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++)
+ {
+ if (!strcasecmp(u->second->server,Current->GetName().c_str()))
{
- if (!strcasecmp(u->second->server,Current->GetName().c_str()))
- {
- Srv->QuitUser(u->second,Current->GetName()+" "+std::string(Srv->GetServerName()));
- num_lost_users++;
- quittingpeople = true;
- break;
- }
+ std::string qreason = Current->GetName()+" "+std::string(Srv->GetServerName());
+ Goners->AddItem(u->second,qreason);
+ num_lost_users++;
}
}
}
@@ -703,10 +693,13 @@ class TreeSocket : public InspSocket
}
num_lost_servers = 0;
num_lost_users = 0;
- SquitServer(Current);
+ CullList* Goners = new CullList();
+ SquitServer(Current, Goners);
+ Goners->Apply();
Current->Tidy();
Current->GetParent()->DelChild(Current);
delete Current;
+ delete Goners;
WriteOpers("Netsplit complete, lost \002%d\002 users on \002%d\002 servers.", num_lost_users, num_lost_servers);
}
else