]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Optimized routing, some O(n) stuff could easily be made 'n'.
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 1 Dec 2005 12:16:18 +0000 (12:16 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 1 Dec 2005 12:16:18 +0000 (12:16 +0000)
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

index 3dfd80edfccb2a6fc3d8ed406d4043263ad0aa04..93fbcd78c652696c668a7a8a8aaaa1d32e80adb2 100644 (file)
@@ -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());