summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-01-05 15:04:01 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-01-05 15:04:01 +0100
commit11916574f67962dce1d7a2fdf7ef6a3d2d1fa49f (patch)
tree1c3c602de5512a62e2db96652ddd540e6e53e821 /src/modules/m_spanningtree
parent2f181fef775da4a686a892c06af843dddfb7950a (diff)
Introduce Server class
- Replaces std::string server in User - Replaces InspIRCd::ULine() and SilentULine()
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/addline.cpp2
-rw-r--r--src/modules/m_spanningtree/commandbuilder.h4
-rw-r--r--src/modules/m_spanningtree/fjoin.cpp8
-rw-r--r--src/modules/m_spanningtree/fmode.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp34
-rw-r--r--src/modules/m_spanningtree/nick.cpp3
-rw-r--r--src/modules/m_spanningtree/opertype.cpp6
-rw-r--r--src/modules/m_spanningtree/override_map.cpp2
-rw-r--r--src/modules/m_spanningtree/postcommand.cpp2
-rw-r--r--src/modules/m_spanningtree/servercommand.h5
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp28
-rw-r--r--src/modules/m_spanningtree/treeserver.h20
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp13
-rw-r--r--src/modules/m_spanningtree/uid.cpp8
-rw-r--r--src/modules/m_spanningtree/utils.cpp20
-rw-r--r--src/modules/m_spanningtree/utils.h1
16 files changed, 97 insertions, 61 deletions
diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp
index c6ca17db0..dbf0003bf 100644
--- a/src/modules/m_spanningtree/addline.cpp
+++ b/src/modules/m_spanningtree/addline.cpp
@@ -60,7 +60,7 @@ CmdResult CommandAddLine::Handle(User* usr, std::vector<std::string>& params)
params[1].c_str(),params[5].c_str());
}
- TreeServer* remoteserver = Utils->FindServer(usr->server);
+ TreeServer* remoteserver = TreeServer::Get(usr);
if (!remoteserver->bursting)
{
diff --git a/src/modules/m_spanningtree/commandbuilder.h b/src/modules/m_spanningtree/commandbuilder.h
index aa4778fa9..cd627227a 100644
--- a/src/modules/m_spanningtree/commandbuilder.h
+++ b/src/modules/m_spanningtree/commandbuilder.h
@@ -133,8 +133,8 @@ class CmdBuilder
return Utils->DoOneToOne(*this, target);
}
- bool Unicast(User* target) const
+ void Unicast(User* target) const
{
- return Unicast(target->server);
+ Utils->DoOneToOne(*this, target->server);
}
};
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp
index 0fb446877..47d8efb82 100644
--- a/src/modules/m_spanningtree/fjoin.cpp
+++ b/src/modules/m_spanningtree/fjoin.cpp
@@ -73,7 +73,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, std::vector<std::string>& params)
if (!TS)
{
ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "*** BUG? *** TS of 0 sent to FJOIN. Are some services authors smoking craq, or is it 1970 again?. Dropped.");
- ServerInstance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FJOIN with a TS of zero. Total craq. Command was dropped.", srcuser->server.c_str());
+ ServerInstance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FJOIN with a TS of zero. Total craq. Command was dropped.", srcuser->server->GetName().c_str());
return CMD_INVALID;
}
@@ -157,7 +157,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, std::vector<std::string>& params)
}
irc::modestacker modestack(true);
- TreeSocket* src_socket = Utils->FindServer(srcuser->server)->GetSocket();
+ TreeSocket* src_socket = TreeServer::Get(srcuser)->GetSocket();
/* Now, process every 'modes,uuid' pair */
irc::tokenstream users(*params.rbegin());
@@ -190,8 +190,8 @@ bool CommandFJoin::ProcessModeUUIDPair(const std::string& item, TreeSocket* src_
}
/* Check that the user's 'direction' is correct */
- TreeServer* route_back_again = Utils->BestRouteTo(who->server);
- if ((!route_back_again) || (route_back_again->GetSocket() != src_socket))
+ TreeServer* route_back_again = TreeServer::Get(who);
+ if (route_back_again->GetSocket() != src_socket)
{
return true;
}
diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp
index 16af5ccc0..bad68f053 100644
--- a/src/modules/m_spanningtree/fmode.cpp
+++ b/src/modules/m_spanningtree/fmode.cpp
@@ -28,7 +28,7 @@ CmdResult CommandFMode::Handle(User* who, std::vector<std::string>& params)
if (!TS)
{
ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "*** BUG? *** TS of 0 sent to FMODE. Are some services authors smoking craq, or is it 1970 again?. Dropping link.");
- ServerInstance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FMODE with a TS of zero. Total craq, dropping link.", who->server.c_str());
+ ServerInstance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FMODE with a TS of zero. Total craq, dropping link.", who->server->GetName().c_str());
return CMD_INVALID;
}
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 8c04d6c90..3efd012ba 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -52,6 +52,17 @@ SpanningTreeCommands::SpanningTreeCommands(ModuleSpanningTree* module)
{
}
+namespace
+{
+ void SetLocalUsersServer(Server* newserver)
+ {
+ ServerInstance->FakeClient->server = newserver;
+ const LocalUserList& list = ServerInstance->Users->local_users;
+ for (LocalUserList::const_iterator i = list.begin(); i != list.end(); ++i)
+ (*i)->server = newserver;
+ }
+}
+
void ModuleSpanningTree::init()
{
ServerInstance->SNO->EnableSnomask('l', "LINK");
@@ -62,6 +73,10 @@ void ModuleSpanningTree::init()
delete ServerInstance->PI;
ServerInstance->PI = new SpanningTreeProtocolInterface;
+
+ delete ServerInstance->FakeClient->server;
+ SetLocalUsersServer(Utils->TreeRoot);
+
loopCall = false;
SplitInProgress = false;
@@ -81,7 +96,7 @@ void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops)
for (TreeServer::ChildServers::const_iterator i = children.begin(); i != children.end(); ++i)
{
TreeServer* server = *i;
- if ((server->Hidden) || ((Utils->HideULines) && (ServerInstance->ULine(server->GetName()))))
+ if ((server->Hidden) || ((Utils->HideULines) && (server->IsULine())))
{
if (user->IsOper())
{
@@ -94,7 +109,7 @@ void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops)
}
}
/* Don't display the line if its a uline, hide ulines is on, and the user isnt an oper */
- if ((Utils->HideULines) && (ServerInstance->ULine(Current->GetName())) && (!user->IsOper()))
+ if ((Utils->HideULines) && (Current->IsULine()) && (!user->IsOper()))
return;
/* Or if the server is hidden and they're not an oper */
else if ((Current->Hidden) && (!user->IsOper()))
@@ -560,20 +575,16 @@ void ModuleSpanningTree::OnUserQuit(User* user, const std::string &reason, const
// Hide the message if one of the following is true:
// - User is being quit due to a netsplit and quietbursts is on
// - Server is a silent uline
- bool hide = (((this->SplitInProgress) && (Utils->quiet_bursts)) || (ServerInstance->SilentULine(user->server)));
+ bool hide = (((this->SplitInProgress) && (Utils->quiet_bursts)) || (user->server->IsSilentULine()));
if (!hide)
{
ServerInstance->SNO->WriteToSnoMask('Q', "Client exiting on server %s: %s (%s) [%s]",
- user->server.c_str(), user->GetFullRealHost().c_str(), user->GetIPString().c_str(), oper_message.c_str());
+ user->server->GetName().c_str(), user->GetFullRealHost().c_str(), user->GetIPString().c_str(), oper_message.c_str());
}
}
// Regardless, We need to modify the user Counts..
- TreeServer* SourceServer = Utils->FindServer(user->server);
- if (SourceServer)
- {
- SourceServer->UserCount--;
- }
+ TreeServer::Get(user)->UserCount--;
}
void ModuleSpanningTree::OnUserPostNick(User* user, const std::string &oldnick)
@@ -624,7 +635,7 @@ void ModuleSpanningTree::OnPreRehash(User* user, const std::string &parameter)
{
CmdBuilder params((user ? user->uuid : ServerInstance->Config->GetSID()), "REHASH");
params.push_back(parameter);
- params.Forward(user ? Utils->BestRouteTo(user->server) : NULL);
+ params.Forward(user ? TreeServer::Get(user)->GetRoute() : NULL);
}
}
@@ -743,6 +754,9 @@ ModuleSpanningTree::~ModuleSpanningTree()
delete ServerInstance->PI;
ServerInstance->PI = new ProtocolInterface;
+ Server* newsrv = new Server(ServerInstance->Config->ServerName);
+ SetLocalUsersServer(newsrv);
+
/* This will also free the listeners */
delete Utils;
diff --git a/src/modules/m_spanningtree/nick.cpp b/src/modules/m_spanningtree/nick.cpp
index 7ace9cc73..eb6c9396f 100644
--- a/src/modules/m_spanningtree/nick.cpp
+++ b/src/modules/m_spanningtree/nick.cpp
@@ -28,6 +28,7 @@
#include "main.h"
#include "utils.h"
#include "commands.h"
+#include "treeserver.h"
CmdResult CommandNick::HandleRemote(RemoteUser* user, std::vector<std::string>& params)
{
@@ -45,7 +46,7 @@ CmdResult CommandNick::HandleRemote(RemoteUser* user, std::vector<std::string>&
if ((x) && (x != user))
{
/* x is local, who is remote */
- int collideret = Utils->DoCollision(x, Utils->FindServer(user->server), user->age, user->ident, user->GetIPString(), user->uuid);
+ int collideret = Utils->DoCollision(x, TreeServer::Get(user), user->age, user->ident, user->GetIPString(), user->uuid);
if (collideret != 1)
{
/*
diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp
index 6e5d473aa..1a9e36f72 100644
--- a/src/modules/m_spanningtree/opertype.cpp
+++ b/src/modules/m_spanningtree/opertype.cpp
@@ -50,12 +50,12 @@ CmdResult CommandOpertype::HandleRemote(RemoteUser* u, std::vector<std::string>&
* If quiet bursts are enabled, and server is bursting or silent uline (i.e. services),
* then do nothing. -- w00t
*/
- TreeServer* remoteserver = Utils->FindServer(u->server);
- if (remoteserver->bursting || ServerInstance->SilentULine(u->server))
+ TreeServer* remoteserver = TreeServer::Get(u);
+ if (remoteserver->bursting || remoteserver->IsSilentULine())
return CMD_SUCCESS;
}
- ServerInstance->SNO->WriteToSnoMask('O',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server.c_str(), u->nick.c_str(),u->ident.c_str(), u->host.c_str(), opertype.c_str());
+ ServerInstance->SNO->WriteToSnoMask('O',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server->GetName().c_str(), u->nick.c_str(),u->ident.c_str(), u->host.c_str(), opertype.c_str());
return CMD_SUCCESS;
}
diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp
index abefa823b..a9b68eb9b 100644
--- a/src/modules/m_spanningtree/override_map.cpp
+++ b/src/modules/m_spanningtree/override_map.cpp
@@ -85,7 +85,7 @@ void CommandMap::ShowMap(TreeServer* Current, User* user, int depth, int &line,
if (!user->IsOper()) {
if (child->Hidden)
continue;
- if ((Utils->HideULines) && (ServerInstance->ULine(child->GetName())))
+ if ((Utils->HideULines) && (child->IsULine()))
continue;
}
ShowMap(child, user, depth, line, names, maxnamew, stats);
diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp
index 57fbca6bc..a059bcb5f 100644
--- a/src/modules/m_spanningtree/postcommand.cpp
+++ b/src/modules/m_spanningtree/postcommand.cpp
@@ -102,7 +102,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm
User* d = ServerInstance->FindNick(dest);
if (!d)
return;
- TreeServer* tsd = BestRouteTo(d->server);
+ TreeServer* tsd = TreeServer::Get(d)->GetRoute();
if (tsd == origin)
// huh? no routing stuff around in a circle, please.
return;
diff --git a/src/modules/m_spanningtree/servercommand.h b/src/modules/m_spanningtree/servercommand.h
index 2bd77fc84..156b405e4 100644
--- a/src/modules/m_spanningtree/servercommand.h
+++ b/src/modules/m_spanningtree/servercommand.h
@@ -20,8 +20,7 @@
#pragma once
#include "utils.h"
-
-class TreeServer;
+#include "treeserver.h"
/** Base class for server-to-server commands that may have a (remote) user source or server source.
*/
@@ -67,7 +66,7 @@ class ServerOnlyServerCommand : public ServerCommand
{
if (!IS_SERVER(user))
return CMD_INVALID;
- TreeServer* server = Utils->FindServer(user->server);
+ TreeServer* server = TreeServer::Get(user);
return static_cast<T*>(this)->HandleServer(server, parameters);
}
};
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index 7d8abf4bf..34b71e07f 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -33,7 +33,8 @@
* no socket associated with it. Its version string is our own local version.
*/
TreeServer::TreeServer()
- : Parent(NULL), Route(NULL), ServerName(ServerInstance->Config->ServerName), ServerDesc(ServerInstance->Config->ServerDesc)
+ : Server(ServerInstance->Config->ServerName)
+ , Parent(NULL), Route(NULL), ServerDesc(ServerInstance->Config->ServerDesc)
, VersionString(ServerInstance->GetVersionString()), Socket(NULL), sid(ServerInstance->Config->GetSID()), ServerUser(ServerInstance->FakeClient)
, age(ServerInstance->Time()), Warned(false), bursting(false), UserCount(0), OperCount(0), rtt(0), StartBurst(0), Hidden(false)
{
@@ -45,9 +46,11 @@ TreeServer::TreeServer()
* its ping counters so that it will be pinged one minute from now.
*/
TreeServer::TreeServer(const std::string& Name, const std::string& Desc, const std::string& id, TreeServer* Above, TreeSocket* Sock, bool Hide)
- : Parent(Above), ServerName(Name), ServerDesc(Desc), Socket(Sock), sid(id), ServerUser(new FakeUser(id, Name))
+ : Server(Name)
+ , Parent(Above), ServerDesc(Desc), Socket(Sock), sid(id), ServerUser(new FakeUser(id, this))
, age(ServerInstance->Time()), Warned(false), bursting(true), UserCount(0), OperCount(0), rtt(0), Hidden(Hide)
{
+ CheckULine();
SetNextPingTime(ServerInstance->Time() + Utils->PingFreq);
SetPingFlag();
@@ -133,8 +136,8 @@ void TreeServer::FinishBurst()
long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000);
unsigned long bursttime = ts - this->StartBurst;
ServerInstance->SNO->WriteToSnoMask(Parent == Utils->TreeRoot ? 'l' : 'L', "Received end of netburst from \2%s\2 (burst time: %lu %s)",
- ServerName.c_str(), (bursttime > 10000 ? bursttime / 1000 : bursttime), (bursttime > 10000 ? "secs" : "msecs"));
- AddServerEvent(Utils->Creator, ServerName);
+ GetName().c_str(), (bursttime > 10000 ? bursttime / 1000 : bursttime), (bursttime > 10000 ? "secs" : "msecs"));
+ AddServerEvent(Utils->Creator, GetName());
}
int TreeServer::QuitUsers(const std::string &reason)
@@ -148,19 +151,30 @@ int TreeServer::QuitUsers(const std::string &reason)
User* user = i->second;
// Increment the iterator now because QuitUser() removes the user from the container
++i;
- if (user->server == ServerName)
+ if (user->server == this)
ServerInstance->Users->QuitUser(user, publicreason, &reason);
}
return original_size - users.size();
}
+void TreeServer::CheckULine()
+{
+ uline = silentuline = false;
+ std::map<irc::string, bool>::iterator it = ServerInstance->Config->ulines.find(GetName().c_str());
+ if (it != ServerInstance->Config->ulines.end())
+ {
+ uline = true;
+ silentuline = it->second;
+ }
+}
+
/** This method is used to add the structure to the
* hash_map for linear searches. It is only called
* by the constructors.
*/
void TreeServer::AddHashEntry()
{
- Utils->serverlist[ServerName] = this;
+ Utils->serverlist[GetName()] = this;
Utils->sidlist[sid] = this;
}
@@ -267,5 +281,5 @@ TreeServer::~TreeServer()
delete ServerUser;
Utils->sidlist.erase(sid);
- Utils->serverlist.erase(ServerName);
+ Utils->serverlist.erase(GetName());
}
diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h
index 8178c87fa..67ce96e63 100644
--- a/src/modules/m_spanningtree/treeserver.h
+++ b/src/modules/m_spanningtree/treeserver.h
@@ -37,12 +37,11 @@
* TreeServer items, deleting and inserting them as they
* are created and destroyed.
*/
-class TreeServer : public classbase
+class TreeServer : public Server
{
TreeServer* Parent; /* Parent entry */
TreeServer* Route; /* Route entry */
std::vector<TreeServer*> Children; /* List of child objects */
- std::string ServerName; /* Server's name */
std::string ServerDesc; /* Server's description */
std::string VersionString; /* Version string or empty string */
TreeSocket* Socket; /* Socket used to communicate with this server */
@@ -94,10 +93,6 @@ class TreeServer : public classbase
*/
bool IsLocal() const { return (this->Route == this); }
- /** Get server name
- */
- const std::string& GetName() const { return ServerName; }
-
/** Get server description (GECOS)
*/
const std::string& GetDesc();
@@ -180,6 +175,10 @@ class TreeServer : public classbase
/** Recursive call for child servers */
void FinishBurstInternal();
+ /** (Re)check the uline state of this server
+ */
+ void CheckULine();
+
CullResult cull();
/** Destructor
@@ -187,4 +186,13 @@ class TreeServer : public classbase
* hash maps.
*/
~TreeServer();
+
+ /** Returns the TreeServer the given user is connected to
+ * @param user The user whose server to return
+ * @return The TreeServer this user is connected to.
+ */
+ static TreeServer* Get(User* user)
+ {
+ return static_cast<TreeServer*>(user->server);
+ }
};
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index b66595bd1..f97ce5539 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -229,7 +229,6 @@ void TreeSocket::ProcessLine(std::string &line)
void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, parameterlist& params)
{
User* who = ServerInstance->FindUUID(prefix);
- std::string direction;
if (!who)
{
@@ -269,10 +268,6 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
}
}
- // Make sure prefix is still good
- direction = who->server;
- prefix = who->uuid;
-
/*
* Check for fake direction here, and drop any instances that are found.
* What is fake direction? Imagine the following server setup:
@@ -289,12 +284,10 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
* a valid SID or a valid UUID, so that invalid UUID or SID never makes it
* to the higher level functions. -- B
*/
- TreeServer* route_back_again = Utils->BestRouteTo(direction);
- if ((!route_back_again) || (route_back_again->GetSocket() != this))
+ TreeServer* route_back_again = TreeServer::Get(who)->GetRoute();
+ if (route_back_again->GetSocket() != this)
{
- if (route_back_again)
- ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Protocol violation: Fake direction '%s' from connection '%s'",
- prefix.c_str(),linkID.c_str());
+ ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Protocol violation: Fake direction '%s' from connection '%s'", prefix.c_str(), linkID.c_str());
return;
}
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp
index 82d78124a..0d96167b9 100644
--- a/src/modules/m_spanningtree/uid.cpp
+++ b/src/modules/m_spanningtree/uid.cpp
@@ -71,7 +71,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vector<std::st
User* _new = NULL;
try
{
- _new = new RemoteUser(params[0], remoteserver->GetName());
+ _new = new RemoteUser(params[0], remoteserver);
}
catch (...)
{
@@ -132,11 +132,11 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vector<std::st
bool dosend = true;
- if ((Utils->quiet_bursts && remoteserver->bursting) || ServerInstance->SilentULine(_new->server))
+ if ((Utils->quiet_bursts && remoteserver->bursting) || _new->server->IsSilentULine())
dosend = false;
if (dosend)
- ServerInstance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s (%s) [%s]", _new->server.c_str(), _new->GetFullRealHost().c_str(), _new->GetIPString().c_str(), _new->fullname.c_str());
+ ServerInstance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s (%s) [%s]", remoteserver->GetName().c_str(), _new->GetFullRealHost().c_str(), _new->GetIPString().c_str(), _new->fullname.c_str());
FOREACH_MOD(OnPostConnect, (_new));
@@ -162,7 +162,7 @@ CmdResult CommandFName::HandleRemote(RemoteUser* src, std::vector<std::string>&
}
CommandUID::Builder::Builder(User* user)
- : CmdBuilder(user->uuid.substr(0, 3), "UID")
+ : CmdBuilder(TreeServer::Get(user)->GetID(), "UID")
{
push(user->uuid);
push_int(user->age);
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index dbd246ffe..fd51fb6b4 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -93,9 +93,7 @@ TreeServer* SpanningTreeUtilities::BestRouteTo(const std::string &ServerName)
User *u = ServerInstance->FindNick(ServerName);
if (u)
{
- Found = FindServer(u->server);
- if (Found)
- return Found->GetRoute();
+ return TreeServer::Get(u)->GetRoute();
}
return NULL;
@@ -180,9 +178,8 @@ void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeSocketSet
if (exempt_list.find(i->first) == exempt_list.end())
{
- TreeServer* best = this->BestRouteTo(i->first->server);
- if (best)
- list.insert(best->GetSocket());
+ TreeServer* best = TreeServer::Get(i->first);
+ list.insert(best->GetSocket());
}
}
return;
@@ -210,10 +207,16 @@ bool SpanningTreeUtilities::DoOneToOne(const CmdBuilder& params, const std::stri
if (!Route)
return false;
- Route->GetSocket()->WriteLine(params);
+ DoOneToOne(params, Route);
return true;
}
+void SpanningTreeUtilities::DoOneToOne(const CmdBuilder& params, Server* server)
+{
+ TreeServer* ts = static_cast<TreeServer*>(server);
+ ts->GetSocket()->WriteLine(params);
+}
+
void SpanningTreeUtilities::RefreshIPCache()
{
ValidIPs.clear();
@@ -349,6 +352,9 @@ void SpanningTreeUtilities::ReadConfiguration()
AutoconnectBlocks.push_back(A);
}
+ for (server_hash::const_iterator i = serverlist.begin(); i != serverlist.end(); ++i)
+ i->second->CheckULine();
+
RefreshIPCache();
}
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 164bed1ca..4005f0db9 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -129,6 +129,7 @@ class SpanningTreeUtilities : public classbase
/** Send a message from this server to one other local or remote
*/
bool DoOneToOne(const CmdBuilder& params, const std::string& target);
+ void DoOneToOne(const CmdBuilder& params, Server* target);
/** Send a message from this server to all but one other, local or remote
*/