summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-01 12:16:18 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-01 12:16:18 +0000
commit95ecb4f922ee0288b06c7397137f5e3c9401dbec (patch)
treeb1139c0cbd98f3c4bd257f7bff01d6a486f9a956 /src/modules/m_spanningtree.cpp
parentf0bc6749980f33ff03e56dce3e29b414f3ecd5e3 (diff)
Optimized routing, some O(n) stuff could easily be made 'n'.
Added ERROR command handlers to states that didnt have them, so that failed authentication from the /connect end now displays the error rather than just sitting there. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2080 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree.cpp')
-rw-r--r--src/modules/m_spanningtree.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 3dfd80edf..93fbcd78c 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -969,6 +969,10 @@ class TreeSocket : public InspSocket
// kickstarts the merge.
return this->Outbound_Reply_Server(params);
}
+ else if (command == "ERROR")
+ {
+ return this->Error(params);
+ }
break;
case CONNECTED:
// This is the 'authenticated' state, when all passwords
@@ -987,6 +991,10 @@ class TreeSocket : public InspSocket
{
return this->RemoteServer(prefix,params);
}
+ else if (command == "ERROR")
+ {
+ return this->Error(params);
+ }
else if (command == "OPERTYPE")
{
return this->OperType(prefix,params);
@@ -1105,10 +1113,11 @@ class TreeSocket : public InspSocket
bool DoOneToAllButSenderRaw(std::string data,std::string omit)
{
+ TreeServer* omitroute = BestRouteTo(omit);
for (unsigned int x = 0; x < TreeRoot->ChildCount(); x++)
{
TreeServer* Route = TreeRoot->GetChild(x);
- if ((Route->GetSocket()) && (Route->GetName() != omit) && (BestRouteTo(omit) != Route))
+ if ((Route->GetSocket()) && (Route->GetName() != omit) && (omitroute != Route))
{
TreeSocket* Sock = Route->GetSocket();
log(DEBUG,"Sending RAW to %s",Route->GetName().c_str());
@@ -1121,6 +1130,7 @@ bool DoOneToAllButSenderRaw(std::string data,std::string omit)
bool DoOneToAllButSender(std::string prefix, std::string command, std::deque<std::string> params, std::string omit)
{
log(DEBUG,"ALLBUTONE: Comes from %s SHOULD NOT go back to %s",prefix.c_str(),omit.c_str());
+ TreeServer* omitroute = BestRouteTo(omit);
// TODO: Special stuff with privmsg and notice
std::string FullLine = ":" + prefix + " " + command;
for (unsigned int x = 0; x < params.size(); x++)
@@ -1134,7 +1144,7 @@ bool DoOneToAllButSender(std::string prefix, std::string command, std::deque<std
// The route has a socket (its a direct connection)
// The route isnt the one to be omitted
// The route isnt the path to the one to be omitted
- if ((Route->GetSocket()) && (Route->GetName() != omit) && (BestRouteTo(omit) != Route))
+ if ((Route->GetSocket()) && (Route->GetName() != omit) && (omitroute != Route))
{
TreeSocket* Sock = Route->GetSocket();
log(DEBUG,"Sending to %s",Route->GetName().c_str());