summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-28 18:33:06 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-28 18:33:06 +0000
commit4840d5e77572f42b710501912d59b5dbb6d2c2af (patch)
tree6ff11fbb04dd9a78ae9befdc66bcdb4ea03aa2a4 /src/modules/m_spanningtree
parentf35e50f35c0174973802721dc6aef980e2eb8196 (diff)
- Tear out a useless load of XLine clutters that did nothing much except confuse things
- Revert back to early 1.0 design of using a single list for line storage. We'll make this work more efficiently than 1.0 though of course. This simplifies the code for expiry, checking, etc. - Merge a bunch of sort callbacks into a single sort callback for class XLine. - Horribly break apply_lines() for the time being. .. and that's probably it. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8398 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp20
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp26
-rw-r--r--src/modules/m_spanningtree/utils.cpp2
-rw-r--r--src/modules/m_spanningtree/utils.h5
4 files changed, 8 insertions, 45 deletions
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index d9d44733d..5b79e1aee 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -1238,26 +1238,6 @@ void TreeSocket::SendXLines(TreeServer* Current)
snprintf(data,MAXBUF,":%s ADDLINE E %s@%s %s %lu %lu :%s\r\n",sn,(*i)->identmask,(*i)->hostmask,(*i)->source,(unsigned long)(*i)->set_time,(unsigned long)(*i)->duration,(*i)->reason);
buffer.append(data);
}
- for (std::vector<ZLine*>::iterator i = Instance->XLines->pzlines.begin(); i != Instance->XLines->pzlines.end(); i++)
- {
- snprintf(data,MAXBUF,":%s ADDLINE Z %s %s %lu %lu :%s\r\n",sn,(*i)->ipaddr,(*i)->source,(unsigned long)(*i)->set_time,(unsigned long)(*i)->duration,(*i)->reason);
- buffer.append(data);
- }
- for (std::vector<QLine*>::iterator i = Instance->XLines->pqlines.begin(); i != Instance->XLines->pqlines.end(); i++)
- {
- snprintf(data,MAXBUF,":%s ADDLINE Q %s %s %lu %lu :%s\r\n",sn,(*i)->nick,(*i)->source,(unsigned long)(*i)->set_time,(unsigned long)(*i)->duration,(*i)->reason);
- buffer.append(data);
- }
- for (std::vector<GLine*>::iterator i = Instance->XLines->pglines.begin(); i != Instance->XLines->pglines.end(); i++)
- {
- snprintf(data,MAXBUF,":%s ADDLINE G %s@%s %s %lu %lu :%s\r\n",sn,(*i)->identmask,(*i)->hostmask,(*i)->source,(unsigned long)(*i)->set_time,(unsigned long)(*i)->duration,(*i)->reason);
- buffer.append(data);
- }
- for (std::vector<ELine*>::iterator i = Instance->XLines->pelines.begin(); i != Instance->XLines->pelines.end(); i++)
- {
- snprintf(data,MAXBUF,":%s ADDLINE E %s@%s %s %lu %lu :%s\r\n",sn,(*i)->identmask,(*i)->hostmask,(*i)->source,(unsigned long)(*i)->set_time,(unsigned long)(*i)->duration,(*i)->reason);
- buffer.append(data);
- }
if (!buffer.empty())
this->WriteLine(buffer);
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 01e1316f5..d8eab8a5e 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -522,22 +522,18 @@ bool TreeSocket::AddLine(const std::string &prefix, std::deque<std::string> &par
{
if (params.size() < 6)
return true;
+
bool propogate = false;
- if (!this->bursting)
- Utils->lines_to_apply = 0;
+
switch (*(params[0].c_str()))
{
case 'Z':
propogate = Instance->XLines->add_zline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
Instance->XLines->zline_set_creation_time(params[1].c_str(), atoi(params[3].c_str()));
- if (propogate)
- Utils->lines_to_apply |= APPLY_ZLINES;
break;
case 'Q':
propogate = Instance->XLines->add_qline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
Instance->XLines->qline_set_creation_time(params[1].c_str(), atoi(params[3].c_str()));
- if (propogate)
- Utils->lines_to_apply |= APPLY_QLINES;
break;
case 'E':
propogate = Instance->XLines->add_eline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
@@ -546,13 +542,9 @@ bool TreeSocket::AddLine(const std::string &prefix, std::deque<std::string> &par
case 'G':
propogate = Instance->XLines->add_gline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
Instance->XLines->gline_set_creation_time(params[1].c_str(), atoi(params[3].c_str()));
- if (propogate)
- Utils->lines_to_apply |= APPLY_GLINES;
break;
case 'K':
propogate = Instance->XLines->add_kline(atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str());
- if (propogate)
- Utils->lines_to_apply |= APPLY_KLINES;
break;
default:
/* Just in case... */
@@ -575,11 +567,12 @@ bool TreeSocket::AddLine(const std::string &prefix, std::deque<std::string> &par
params[5] = ":" + params[5];
Utils->DoOneToAllButSender(prefix,"ADDLINE",params,prefix);
}
+
if (!this->bursting)
{
- Instance->XLines->apply_lines(Utils->lines_to_apply);
- Utils->lines_to_apply = 0;
+ Instance->XLines->apply_lines();
}
+
return true;
}
@@ -1347,8 +1340,7 @@ bool TreeSocket::ProcessLine(std::string &line)
if (this->bursting)
{
this->bursting = false;
- Instance->XLines->apply_lines(Utils->lines_to_apply);
- Utils->lines_to_apply = 0;
+ Instance->XLines->apply_lines();
}
return this->LocalPing(prefix,params);
@@ -1367,8 +1359,7 @@ bool TreeSocket::ProcessLine(std::string &line)
if (this->bursting)
{
this->bursting = false;
- Instance->XLines->apply_lines(Utils->lines_to_apply);
- Utils->lines_to_apply = 0;
+ Instance->XLines->apply_lines();
}
return this->LocalPong(prefix,params);
@@ -1486,8 +1477,7 @@ bool TreeSocket::ProcessLine(std::string &line)
else if (command == "ENDBURST")
{
this->bursting = false;
- Instance->XLines->apply_lines(Utils->lines_to_apply);
- Utils->lines_to_apply = 0;
+ Instance->XLines->apply_lines();
std::string sourceserv = this->myhost;
if (!this->InboundServerName.empty())
sourceserv = this->InboundServerName;
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 0376ea0c2..f147a6f79 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -177,8 +177,6 @@ SpanningTreeUtilities::SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningT
{
Bindings.clear();
- lines_to_apply = 0;
-
this->TreeRoot = new TreeServer(this, ServerInstance, ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc, ServerInstance->Config->GetSID());
modulelist* ml = ServerInstance->Modules->FindInterface("BufferedSocketHook");
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 38ddba0ed..d437b998b 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -94,11 +94,6 @@ class SpanningTreeUtilities
/** Holds the data from the <link> tags in the conf
*/
std::vector<Link> LinkBlocks;
- /** Holds a bitmask of queued xline types waiting to be applied.
- * Will be a mask containing values APPLY_GLINES, APPLY_KLINES,
- * APPLY_QLINES and APPLY_ZLINES.
- */
- int lines_to_apply;
/** If this is true, this server is the master sync server for time
* synching - e.g. it is the server with its clock correct. It will