From 95ecb4f922ee0288b06c7397137f5e3c9401dbec Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 1 Dec 2005 12:16:18 +0000 Subject: [PATCH] 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 --- src/modules/m_spanningtree.cpp | 14 ++++++++++++-- 1 file 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 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::dequeGetSocket()) && (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()); -- 2.39.5