From a1c889801aed91c5ee671cb1175c56116c406f8a Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 7 Feb 2007 17:50:41 +0000 Subject: Support port binding here git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6535 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/link.h | 1 + src/modules/m_spanningtree/main.cpp | 2 +- src/modules/m_spanningtree/resolvers.cpp | 2 +- src/modules/m_spanningtree/treesocket.h | 2 +- src/modules/m_spanningtree/treesocket1.cpp | 4 ++-- src/modules/m_spanningtree/utils.cpp | 1 + 6 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/link.h b/src/modules/m_spanningtree/link.h index 92fc8db9f..9941939eb 100644 --- a/src/modules/m_spanningtree/link.h +++ b/src/modules/m_spanningtree/link.h @@ -21,6 +21,7 @@ class Link : public classbase std::string FailOver; std::string Hook; int Timeout; + std::string Bind; }; #endif diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 75039840e..210d14acf 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -462,7 +462,7 @@ void ModuleSpanningTree::ConnectServer(Link* x) /* Gave a hook, but it wasnt one we know */ if ((!x->Hook.empty()) && (Utils->hooks.find(x->Hook.c_str()) == Utils->hooks.end())) return; - TreeSocket* newsocket = new TreeSocket(Utils, ServerInstance, x->IPAddr,x->Port,false,x->Timeout ? x->Timeout : 10,x->Name.c_str(), x->Hook.empty() ? NULL : Utils->hooks[x->Hook.c_str()]); + TreeSocket* newsocket = new TreeSocket(Utils, ServerInstance, x->IPAddr,x->Port,false,x->Timeout ? x->Timeout : 10,x->Name.c_str(), x->Bind, x->Hook.empty() ? NULL : Utils->hooks[x->Hook.c_str()]); if (newsocket->GetFd() > -1) { /* Handled automatically on success */ diff --git a/src/modules/m_spanningtree/resolvers.cpp b/src/modules/m_spanningtree/resolvers.cpp index 6fa3bbc82..b716a5c1d 100644 --- a/src/modules/m_spanningtree/resolvers.cpp +++ b/src/modules/m_spanningtree/resolvers.cpp @@ -44,7 +44,7 @@ void ServernameResolver::OnLookupComplete(const std::string &result, unsigned in return; TreeSocket* newsocket = new TreeSocket(this->Utils, ServerInstance, result,MyLink.Port,false,MyLink.Timeout ? MyLink.Timeout : 10,MyLink.Name.c_str(), - MyLink.Hook.empty() ? NULL : Utils->hooks[MyLink.Hook.c_str()]); + MyLink.Bind, MyLink.Hook.empty() ? NULL : Utils->hooks[MyLink.Hook.c_str()]); if (newsocket->GetFd() > -1) { /* We're all OK */ diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 63b27cecf..24b250dba 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -89,7 +89,7 @@ class TreeSocket : public InspSocket */ TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, Module* HookMod = NULL); - TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, std::string ServerName, Module* HookMod = NULL); + TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Module* HookMod = NULL); /** When a listening socket gives us a new file descriptor, * we must associate it with a socket without creating a new diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index a772c8124..1e25a2fff 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -35,8 +35,8 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string ho InspSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); } -TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, std::string ServerName, Module* HookMod) - : InspSocket(SI, host, port, listening, maxtime), Utils(Util), Hook(HookMod) +TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Module* HookMod) + : InspSocket(SI, host, port, listening, maxtime, bindto), Utils(Util), Hook(HookMod) { myhost = ServerName; this->LinkState = CONNECTING; diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index c21a61599..38e25657c 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -394,6 +394,7 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) L.HiddenFromStats = Conf->ReadFlag("link","hidden",j); L.Timeout = Conf->ReadInteger("link","timeout",j,true); L.Hook = Conf->ReadValue("link", "transport", j); + L.Bind = Conf->ReadValue("link", "bind", j); if ((!L.Hook.empty()) && (hooks.find(L.Hook.c_str()) == hooks.end())) { -- cgit v1.2.3