summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/override_stats.cpp17
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp23
-rw-r--r--src/modules/m_spanningtree/utils.cpp20
-rw-r--r--src/modules/m_spanningtree/utils.h9
4 files changed, 32 insertions, 37 deletions
diff --git a/src/modules/m_spanningtree/override_stats.cpp b/src/modules/m_spanningtree/override_stats.cpp
index 09d0a691d..f43aa8d3b 100644
--- a/src/modules/m_spanningtree/override_stats.cpp
+++ b/src/modules/m_spanningtree/override_stats.cpp
@@ -65,23 +65,6 @@ ModResult ModuleSpanningTree::OnStats(char statschar, User* user, string_list &r
}
return MOD_RES_DENY;
}
-
- if (statschar == 'p')
- {
- /* show all server ports, after showing client ports. -- w00t */
-
- for (unsigned int i = 0; i < Utils->Bindings.size(); i++)
- {
- std::string ip = Utils->Bindings[i]->GetIP();
- if (ip.empty())
- ip = "*";
-
- std::string transport(Utils->Bindings[i]->Hook);
-
- results.push_back(ServerInstance->Config->ServerName + " 249 "+user->nick+" :" + ip + ":" + ConvToStr(Utils->Bindings[i]->GetPort())+
- " (server, " + transport + ")");
- }
- }
return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index 2c845bbd4..432ee2a09 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -38,9 +38,30 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, const std::string& shost, in
capab_phase = 0;
proto_version = 0;
LinkState = CONNECTING;
+ if (!hook.empty())
+ {
+ modulelist* ml = ServerInstance->Modules->FindInterface("BufferedSocketHook");
+ if (ml)
+ {
+ for(modulelist::iterator i = ml->begin(); i != ml->end(); ++i)
+ {
+ std::string name = (**i).ModuleSourceFile;
+ int a = name.rfind('_');
+ int b = name.rfind('.');
+ name = name.substr(a, b-a-1);
+ if (name == hook)
+ {
+ AddIOHook(*i);
+ goto found;
+ }
+ }
+ }
+ SetError("Could not find hook '" + hook + "' for connection to " + ServerName);
+ return;
+ }
+found:
DoConnect(shost, iport, maxtime, bindto);
Utils->timeoutlist[this] = std::pair<std::string, int>(ServerName, maxtime);
- // TODO AddIOHook using the given hook
SendCapabilities(1);
}
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 3b70fce31..09333fdd2 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -153,9 +153,10 @@ SpanningTreeUtilities::SpanningTreeUtilities(ModuleSpanningTree* C) : Creator(C)
bool SpanningTreeUtilities::cull()
{
- for (unsigned int i = 0; i < Bindings.size(); i++)
+ for (unsigned int i = 0; i < ServerInstance->ports.size(); i++)
{
- Bindings[i]->cull();
+ if (ServerInstance->ports[i]->type == "servers")
+ ServerInstance->ports[i]->cull();
}
while (TreeRoot->ChildCount())
@@ -177,9 +178,10 @@ bool SpanningTreeUtilities::cull()
SpanningTreeUtilities::~SpanningTreeUtilities()
{
- for (unsigned int i = 0; i < Bindings.size(); i++)
+ for (unsigned int i = 0; i < ServerInstance->ports.size(); i++)
{
- delete Bindings[i];
+ if (ServerInstance->ports[i]->type == "servers")
+ delete ServerInstance->ports[i];
}
delete TreeRoot;
@@ -383,12 +385,6 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
if (rebind)
{
- for (unsigned int i = 0; i < Bindings.size(); i++)
- {
- delete Bindings[i];
- }
- Bindings.clear();
-
for (int j = 0; j < Conf->Enumerate("bind"); j++)
{
std::string Type = Conf->ReadValue("bind","type",j);
@@ -412,7 +408,7 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
continue;
}
- Bindings.push_back(listener);
+ ServerInstance->ports.push_back(listener);
}
}
}
@@ -448,7 +444,7 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
L->Fingerprint = Conf->ReadValue("link", "fingerprint", j);
L->HiddenFromStats = Conf->ReadFlag("link", "statshidden", j);
L->Timeout = Conf->ReadInteger("link", "timeout", j, true);
- L->Hook = Conf->ReadValue("link", "transport", j);
+ L->Hook = Conf->ReadValue("link", "ssl", j);
L->Bind = Conf->ReadValue("link", "bind", j);
L->Hidden = Conf->ReadFlag("link", "hidden", j);
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 7c15b2839..48677e57d 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -45,13 +45,11 @@ class ServerSocketListener : public ListenSocketBase
SpanningTreeUtilities *Utils;
public:
- ServerSocketListener(SpanningTreeUtilities *u, int port, const std::string& addr, const std::string& hook)
- : ListenSocketBase(port, addr), Utils(u), Hook(hook)
+ ServerSocketListener(SpanningTreeUtilities *u, int port, const std::string& addr, const std::string& Hook)
+ : ListenSocketBase(port, addr, "servers", Hook), Utils(u)
{
}
- std::string Hook;
-
virtual void OnAcceptReady(int nfd);
};
@@ -85,9 +83,6 @@ class SpanningTreeUtilities : public classbase
*/
bool quiet_bursts;
- /** Socket bindings for listening sockets
- */
- std::vector<ServerSocketListener *> Bindings;
/* Number of seconds that a server can go without ping
* before opers are warned of high latency.
*/