summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree/capab.cpp6
-rw-r--r--src/modules/m_spanningtree/main.cpp9
-rw-r--r--src/modules/m_spanningtree/resolvers.cpp3
-rw-r--r--src/modules/m_spanningtree/server.cpp27
-rw-r--r--src/modules/m_spanningtree/treesocket.h52
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp79
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp62
-rw-r--r--src/modules/m_spanningtree/utils.cpp3
8 files changed, 84 insertions, 157 deletions
diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp
index 64cfef9d7..1e2fe710a 100644
--- a/src/modules/m_spanningtree/capab.cpp
+++ b/src/modules/m_spanningtree/capab.cpp
@@ -17,6 +17,7 @@
#include "treesocket.h"
#include "treeserver.h"
#include "utils.h"
+#include "link.h"
#include "main.h"
std::string TreeSocket::MyModules(int filter)
@@ -315,8 +316,7 @@ bool TreeSocket::Capab(const parameterlist &params)
if (!this->GetTheirChallenge().empty() && (this->LinkState == CONNECTING))
{
this->SendCapabilities(2);
- this->WriteLine(std::string("SERVER ")+ServerInstance->Config->ServerName+" "+this->MakePass(capab->OutboundPass, this->GetTheirChallenge())+" 0 "+
- ServerInstance->Config->GetSID()+" :"+ServerInstance->Config->ServerDesc);
+ this->WriteLine(std::string("SERVER ")+ServerInstance->Config->ServerName+" "+this->MakePass(capab->link->SendPass, capab->theirchallenge)+" 0 "+ServerInstance->Config->GetSID()+" :"+ServerInstance->Config->ServerDesc);
}
}
else
@@ -325,7 +325,7 @@ bool TreeSocket::Capab(const parameterlist &params)
if (this->LinkState == CONNECTING)
{
this->SendCapabilities(2);
- this->WriteLine(std::string("SERVER ")+ServerInstance->Config->ServerName+" "+capab->OutboundPass+" 0 "+ServerInstance->Config->GetSID()+" :"+ServerInstance->Config->ServerDesc);
+ this->WriteLine(std::string("SERVER ")+ServerInstance->Config->ServerName+" "+capab->link->SendPass+" 0 "+ServerInstance->Config->GetSID()+" :"+ServerInstance->Config->ServerDesc);
}
}
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index ee2118915..11b309557 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -277,8 +277,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y)
if (ipvalid)
{
/* Gave a hook, but it wasnt one we know */
- TreeSocket* newsocket = new TreeSocket(Utils, x->IPAddr, x->Port, x->Timeout ? x->Timeout : 10,
- x->Name.c_str(), x->Bind, y, x->Hook);
+ TreeSocket* newsocket = new TreeSocket(Utils, x, y, x->IPAddr);
if (newsocket->GetFd() > -1)
{
/* Handled automatically on success */
@@ -328,12 +327,16 @@ void ModuleSpanningTree::DoConnectTimeout(time_t curtime)
std::pair<std::string, int> p = i->second;
std::map<TreeSocket*, std::pair<std::string, int> >::iterator me = i;
i++;
+ if (s->GetLinkState() == DYING)
+ {
+ Utils->timeoutlist.erase(me);
+ s->Close();
+ }
if (curtime > s->age + p.second)
{
ServerInstance->SNO->WriteToSnoMask('l',"CONNECT: Error connecting \002%s\002 (timeout of %d seconds)",p.first.c_str(),p.second);
Utils->timeoutlist.erase(me);
s->Close();
- ServerInstance->GlobalCulls.AddItem(s);
}
}
}
diff --git a/src/modules/m_spanningtree/resolvers.cpp b/src/modules/m_spanningtree/resolvers.cpp
index 2f8854c6c..116b2a142 100644
--- a/src/modules/m_spanningtree/resolvers.cpp
+++ b/src/modules/m_spanningtree/resolvers.cpp
@@ -44,8 +44,7 @@ void ServernameResolver::OnLookupComplete(const std::string &result, unsigned in
TreeServer* CheckDupe = Utils->FindServer(MyLink->Name.c_str());
if (!CheckDupe) /* Check that nobody tried to connect it successfully while we were resolving */
{
- TreeSocket* newsocket = new TreeSocket(Utils, result, MyLink->Port, MyLink->Timeout ? MyLink->Timeout : 10,
- MyLink->Name.c_str(), MyLink->Bind, myautoconnect, MyLink->Hook);
+ TreeSocket* newsocket = new TreeSocket(Utils, MyLink, myautoconnect, result);
if (newsocket->GetFd() > -1)
{
/* We're all OK */
diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp
index 393d6d8fc..82777845e 100644
--- a/src/modules/m_spanningtree/server.cpp
+++ b/src/modules/m_spanningtree/server.cpp
@@ -100,10 +100,6 @@ bool TreeSocket::Outbound_Reply_Server(parameterlist &params)
std::string description = params[4];
int hops = atoi(params[2].c_str());
- this->InboundServerName = sname;
- this->InboundDescription = description;
- this->InboundSID = sid;
-
this->SendCapabilities(2);
if (hops)
@@ -157,18 +153,18 @@ bool TreeSocket::Outbound_Reply_Server(parameterlist &params)
this->LinkState = CONNECTED;
Utils->timeoutlist.erase(this);
+ linkID = sname;
- TreeServer *Node = new TreeServer(Utils, sname, description, sid, Utils->TreeRoot, this, x->Hidden);
+ MyRoot = new TreeServer(Utils, sname, description, sid, Utils->TreeRoot, this, x->Hidden);
- Utils->TreeRoot->AddChild(Node);
+ Utils->TreeRoot->AddChild(MyRoot);
params[4] = ":" + params[4];
-
/* IMPORTANT: Take password/hmac hash OUT of here before we broadcast the introduction! */
params[1] = "*";
Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(),"SERVER",params,sname);
- this->DoBurst(Node);
+ this->DoBurst(MyRoot);
return true;
}
@@ -196,10 +192,6 @@ bool TreeSocket::Inbound_Server(parameterlist &params)
std::string description = params[4];
int hops = atoi(params[2].c_str());
- this->InboundServerName = sname;
- this->InboundDescription = description;
- this->InboundSID = sid;
-
this->SendCapabilities(2);
if (hops)
@@ -248,14 +240,21 @@ bool TreeSocket::Inbound_Server(parameterlist &params)
return false;
}
-
- ServerInstance->SNO->WriteToSnoMask('l',"Verified incoming server connection from \002"+sname+"\002["+(x->HiddenFromStats ? "<hidden>" : this->IP)+"] ("+description+")");
+ ServerInstance->SNO->WriteToSnoMask('l',"Verified incoming server connection " + linkID + " ("+description+")");
+ linkID = sname;
// this is good. Send our details: Our server name and description and hopcount of 0,
// along with the sendpass from this block.
this->SendCapabilities(2);
this->WriteLine(std::string("SERVER ")+ServerInstance->Config->ServerName+" "+this->MakePass(x->SendPass, this->GetTheirChallenge())+" 0 "+ServerInstance->Config->GetSID()+" :"+ServerInstance->Config->ServerDesc);
// move to the next state, we are now waiting for THEM.
+ MyRoot = new TreeServer(Utils, sname, description, sid, Utils->TreeRoot, this, x->Hidden);
+ Utils->TreeRoot->AddChild(MyRoot);
+
+ params[1] = "*";
+ params[4] = ":" + params[4];
+ Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(),"SERVER",params,sname);
+
this->LinkState = WAIT_AUTH_2;
return true;
}
diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h
index 5cd935eb9..2ad4d68af 100644
--- a/src/modules/m_spanningtree/treesocket.h
+++ b/src/modules/m_spanningtree/treesocket.h
@@ -57,6 +57,8 @@ enum ServerState { CONNECTING, WAIT_AUTH_1, WAIT_AUTH_2, CONNECTED, DYING };
struct CapabData
{
+ reference<Link> link; /* Link block used for this connection */
+ reference<Autoconnect> ac; /* Autoconnect used to cause this connection, if any */
std::string ModuleList; /* Required module list of other server from CAPAB */
std::string OptModuleList; /* Optional module list of other server from CAPAB */
std::string ChanModes;
@@ -64,40 +66,26 @@ struct CapabData
std::map<std::string,std::string> CapKeys; /* CAPAB keys from other server */
std::string ourchallenge; /* Challenge sent for challenge/response */
std::string theirchallenge; /* Challenge recv for challenge/response */
- std::string OutboundPass; /* Outbound password */
int capab_phase; /* Have sent CAPAB already */
bool auth_fingerprint; /* Did we auth using SSL fingerprint */
bool auth_challenge; /* Did we auth using challenge/response */
};
-/** Every SERVER connection inbound or outbound is represented by
- * an object of type TreeSocket.
- * TreeSockets, being inherited from BufferedSocket, can be tied into
- * the core socket engine, and we cn therefore receive activity events
- * for them, just like activex objects on speed. (yes really, that
- * is a technical term!) Each of these which relates to a locally
- * connected server is assocated with it, by hooking it onto a
- * TreeSocket class using its constructor. In this way, we can
- * maintain a list of servers, some of which are directly connected,
- * some of which are not.
+/** Every SERVER connection inbound or outbound is represented by an object of
+ * type TreeSocket. During setup, the object can be found in Utils->timeoutlist;
+ * after setup, MyRoot will have been created as a child of Utils->TreeRoot
*/
class TreeSocket : public BufferedSocket
{
SpanningTreeUtilities* Utils; /* Utility class */
- std::string myhost; /* Canonical hostname */
+ std::string linkID; /* Description for this link */
ServerState LinkState; /* Link state */
- std::string InboundServerName; /* Server name sent to us by other side */
- std::string InboundDescription; /* Server description (GECOS) sent to us by the other side */
- std::string InboundSID; /* Server ID sent to us by the other side */
- std::string IP;
- CapabData* capab;
- int num_lost_users; /* Users lost in split */
- int num_lost_servers; /* Servers lost in split */
+ CapabData* capab; /* Link setup data (held until burst is sent) */
+ TreeServer* MyRoot; /* The server we are talking to */
time_t NextPing; /* Time when we are due to ping this server */
bool LastPingWasGood; /* Responded to last ping we sent? */
int proto_version; /* Remote protocol version */
public:
- reference<Autoconnect> myautoconnect; /* Autoconnect used to cause this connection, if any */
time_t age;
/** Because most of the I/O gubbins are encapsulated within
@@ -105,7 +93,7 @@ class TreeSocket : public BufferedSocket
* most of the action, and append a few of our own values
* to it.
*/
- TreeSocket(SpanningTreeUtilities* Util, const std::string& host, int port, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Autoconnect* myac, const std::string& Hook);
+ TreeSocket(SpanningTreeUtilities* Util, Link* link, Autoconnect* myac, const std::string& ipaddr);
/** When a listening socket gives us a new file descriptor,
* we must associate it with a socket without creating a new
@@ -203,7 +191,7 @@ class TreeSocket : public BufferedSocket
* is having a REAL bad hair day, this function shouldnt be called
* too many times a month ;-)
*/
- void SquitServer(std::string &from, TreeServer* Current);
+ void SquitServer(std::string &from, TreeServer* Current, int& num_lost_servers, int& num_lost_users);
/** This is a wrapper function for SquitServer above, which
* does some validation first and passes on the SQUIT to all
@@ -312,10 +300,6 @@ class TreeSocket : public BufferedSocket
void ProcessConnectedLine(std::string& prefix, std::string& command, parameterlist& params);
- /** Get this server's name
- */
- virtual std::string GetName();
-
/** Handle socket timeout from connect()
*/
virtual void OnTimeout();
@@ -324,21 +308,5 @@ class TreeSocket : public BufferedSocket
virtual void Close();
};
-/* Used to validate the value lengths of multiple parameters for a command */
-struct cmd_validation
-{
- const char* item;
- size_t param;
- size_t length;
-};
-
-/* Used to validate the length values in CAPAB CAPABILITIES */
-struct cap_validation
-{
- const char* reason;
- const char* key;
- size_t size;
-};
-
#endif
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index 79da951b6..596f31041 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -30,27 +30,30 @@
* most of the action, and append a few of our own values
* to it.
*/
-TreeSocket::TreeSocket(SpanningTreeUtilities* Util, const std::string& shost, int iport, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Autoconnect* myac, const std::string& hook)
- : Utils(Util), IP(shost), myautoconnect(myac)
+TreeSocket::TreeSocket(SpanningTreeUtilities* Util, Link* link, Autoconnect* myac, const std::string& ipaddr)
+ : Utils(Util)
{
age = ServerInstance->Time();
- myhost = ServerName;
+ linkID = assign(link->Name);
capab = new CapabData;
+ capab->link = link;
+ capab->ac = myac;
capab->capab_phase = 0;
+ MyRoot = NULL;
proto_version = 0;
LinkState = CONNECTING;
- if (!hook.empty())
+ if (!link->Hook.empty())
{
- ServiceProvider* prov = ServerInstance->Modules->FindService(SERVICE_IOHOOK, hook);
+ ServiceProvider* prov = ServerInstance->Modules->FindService(SERVICE_IOHOOK, link->Hook);
if (!prov)
{
- SetError("Could not find hook '" + hook + "' for connection to " + ServerName);
+ SetError("Could not find hook '" + link->Hook + "' for connection to " + linkID);
return;
}
AddIOHook(prov->creator);
}
- DoConnect(shost, iport, maxtime, bindto);
- Utils->timeoutlist[this] = std::pair<std::string, int>(ServerName, maxtime);
+ DoConnect(ipaddr, link->Port, link->Timeout, link->Bind);
+ Utils->timeoutlist[this] = std::pair<std::string, int>(linkID, link->Timeout);
SendCapabilities(1);
}
@@ -62,19 +65,19 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, int newfd, ListenSocket* via
: BufferedSocket(newfd), Utils(Util)
{
capab = new CapabData;
- IP = client->addr();
+ capab->capab_phase = 0;
+ MyRoot = NULL;
age = ServerInstance->Time();
LinkState = WAIT_AUTH_1;
- capab->capab_phase = 0;
proto_version = 0;
- myhost = "inbound from " + IP;
+ linkID = "inbound from " + client->addr();
FOREACH_MOD(I_OnHookIO, OnHookIO(this, via));
if (GetIOHook())
GetIOHook()->OnStreamSocketAccept(this, client, server);
SendCapabilities(1);
- Utils->timeoutlist[this] = std::pair<std::string, int>(myhost, 30);
+ Utils->timeoutlist[this] = std::pair<std::string, int>(linkID, 30);
}
ServerState TreeSocket::GetLinkState()
@@ -84,6 +87,9 @@ ServerState TreeSocket::GetLinkState()
void TreeSocket::CleanNegotiationInfo()
{
+ // connect is good, reset the autoconnect block (if used)
+ if (capab->ac)
+ capab->ac->position = -1;
delete capab;
capab = NULL;
}
@@ -91,8 +97,8 @@ void TreeSocket::CleanNegotiationInfo()
CullResult TreeSocket::cull()
{
Utils->timeoutlist.erase(this);
- if (myautoconnect)
- Utils->Creator->ConnectServer(myautoconnect, false);
+ if (capab && capab->ac)
+ Utils->Creator->ConnectServer(capab->ac, false);
return this->BufferedSocket::cull();
}
@@ -112,31 +118,16 @@ void TreeSocket::OnConnected()
{
if (this->LinkState == CONNECTING)
{
- /* we do not need to change state here. */
- for (std::vector<reference<Link> >::iterator i = Utils->LinkBlocks.begin(); i < Utils->LinkBlocks.end(); ++i)
- {
- Link* x = *i;
- if (x->Name == this->myhost)
- {
- ServerInstance->SNO->WriteGlobalSno('l', "Connection to \2%s\2[%s] started.", myhost.c_str(), (x->HiddenFromStats ? "<hidden>" : this->IP.c_str()));
- capab->OutboundPass = x->SendPass;
- this->SendCapabilities(1);
- return;
- }
- }
+ ServerInstance->SNO->WriteGlobalSno('l', "Connection to \2%s\2[%s] started.", linkID.c_str(),
+ (capab->link->HiddenFromStats ? "<hidden>" : capab->link->IPAddr.c_str()));
+ this->SendCapabilities(1);
}
- /* There is a (remote) chance that between the /CONNECT and the connection
- * being accepted, some muppet has removed the <link> block and rehashed.
- * If that happens the connection hangs here until it's closed. Unlikely
- * and rather harmless.
- */
- ServerInstance->SNO->WriteGlobalSno('l', "Connection to \2%s\2 lost link tag(!)", myhost.c_str());
}
void TreeSocket::OnError(BufferedSocketError e)
{
ServerInstance->SNO->WriteGlobalSno('l', "Connection to \002%s\002 failed with error: %s",
- myhost.c_str(), getError().c_str());
+ linkID.c_str(), getError().c_str());
LinkState = DYING;
}
@@ -154,7 +145,7 @@ void TreeSocket::SendError(const std::string &errormessage)
* is having a REAL bad hair day, this function shouldnt be called
* too many times a month ;-)
*/
-void TreeSocket::SquitServer(std::string &from, TreeServer* Current)
+void TreeSocket::SquitServer(std::string &from, TreeServer* Current, int& num_lost_servers, int& num_lost_users)
{
ServerInstance->Logs->Log("m_spanningtree",DEBUG,"SquitServer for %s from %s",
Current->GetName().c_str(), from.c_str());
@@ -165,7 +156,7 @@ void TreeSocket::SquitServer(std::string &from, TreeServer* Current)
for (unsigned int q = 0; q < Current->ChildCount(); q++)
{
TreeServer* recursive_server = Current->GetChild(q);
- this->SquitServer(from,recursive_server);
+ this->SquitServer(from,recursive_server, num_lost_servers, num_lost_users);
}
/* Now we've whacked the kids, whack self */
num_lost_servers++;
@@ -197,19 +188,21 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason)
{
ServerInstance->SNO->WriteGlobalSno('L', "Server \002"+Current->GetName()+"\002 split from server \002"+Current->GetParent()->GetName()+"\002 with reason: "+reason);
}
- num_lost_servers = 0;
- num_lost_users = 0;
+ int num_lost_servers = 0;
+ int num_lost_users = 0;
std::string from = Current->GetParent()->GetName()+" "+Current->GetName();
- SquitServer(from, Current);
+ SquitServer(from, Current, num_lost_servers, num_lost_users);
+ ServerInstance->SNO->WriteToSnoMask(LocalSquit ? 'l' : 'L', "Netsplit complete, lost \002%d\002 user%s on \002%d\002 server%s.",
+ num_lost_users, num_lost_users != 1 ? "s" : "", num_lost_servers, num_lost_servers != 1 ? "s" : "");
Current->Tidy();
Current->GetParent()->DelChild(Current);
Current->cull();
delete Current;
- Current = NULL;
- if (LocalSquit)
- ServerInstance->SNO->WriteToSnoMask('l', "Netsplit complete, lost \002%d\002 user%s on \002%d\002 server%s.", num_lost_users, num_lost_users != 1 ? "s" : "", num_lost_servers, num_lost_servers != 1 ? "s" : "");
- else
- ServerInstance->SNO->WriteToSnoMask('L', "Netsplit complete, lost \002%d\002 user%s on \002%d\002 server%s.", num_lost_users, num_lost_users != 1 ? "s" : "", num_lost_servers, num_lost_servers != 1 ? "s" : "");
+ if (Current == MyRoot)
+ {
+ MyRoot = NULL;
+ Close();
+ }
}
else
ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Squit from unknown server");
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 42921058c..63b73186a 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -82,8 +82,6 @@ void TreeSocket::ProcessLine(std::string &line)
switch (this->LinkState)
{
- TreeServer* Node;
-
case WAIT_AUTH_1:
/*
* State WAIT_AUTH_1:
@@ -158,27 +156,10 @@ void TreeSocket::ProcessLine(std::string &line)
this->LinkState = CONNECTED;
Utils->timeoutlist.erase(this);
- if (myautoconnect)
- {
- myautoconnect->position = -1;
- myautoconnect = NULL;
- }
-
- Link* lnk = Utils->FindLink(InboundServerName);
-
- Node = new TreeServer(this->Utils, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false);
-
- Utils->TreeRoot->AddChild(Node);
parameterlist sparams;
- sparams.push_back(InboundServerName);
- sparams.push_back("*");
- sparams.push_back("1");
- sparams.push_back(InboundSID);
- sparams.push_back(":"+InboundDescription);
- Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(),"SERVER",sparams,InboundServerName);
- Utils->DoOneToAllButSender(prefix, "BURST", params, InboundServerName);
- Node->bursting = true;
- this->DoBurst(Node);
+ Utils->DoOneToAllButSender(prefix, "BURST", params, MyRoot->GetName());
+ MyRoot->bursting = true;
+ this->DoBurst(MyRoot);
}
else if (command == "ERROR")
{
@@ -237,7 +218,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
{
TreeServer* ServerSource = Utils->FindServer(prefix);
if (prefix.empty())
- ServerSource = Utils->FindServer(GetName());
+ ServerSource = MyRoot;
if (ServerSource)
{
@@ -280,7 +261,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
{
if (route_back_again)
ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Protocol violation: Fake direction '%s' from connection '%s'",
- prefix.c_str(),this->GetName().c_str());
+ prefix.c_str(),linkID.c_str());
return;
}
@@ -450,46 +431,31 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
}
}
-std::string TreeSocket::GetName()
-{
- std::string sourceserv = this->myhost;
- if (!this->InboundServerName.empty())
- {
- sourceserv = this->InboundServerName;
- }
- return sourceserv;
-}
-
void TreeSocket::OnTimeout()
{
- ServerInstance->SNO->WriteGlobalSno('l', "CONNECT: Connection to \002%s\002 timed out.", myhost.c_str());
+ ServerInstance->SNO->WriteGlobalSno('l', "CONNECT: Connection to \002%s\002 timed out.", linkID.c_str());
}
void TreeSocket::Close()
{
+ if (fd != -1)
+ ServerInstance->GlobalCulls.AddItem(this);
this->BufferedSocket::Close();
SetError("Remote host closed connection");
// Connection closed.
// If the connection is fully up (state CONNECTED)
// then propogate a netsplit to all peers.
- std::string quitserver = this->myhost;
- if (!this->InboundServerName.empty())
- {
- quitserver = this->InboundServerName;
- }
- TreeServer* s = Utils->FindServer(quitserver);
- if (s && s->GetSocket() == this)
- {
- Squit(s,getError());
- }
+ if (MyRoot)
+ Squit(MyRoot,getError());
- if (!quitserver.empty())
+ if (!linkID.empty())
{
- ServerInstance->SNO->WriteGlobalSno('l', "Connection to '\2%s\2' failed.",quitserver.c_str());
+ ServerInstance->SNO->WriteGlobalSno('l', "Connection to '\2%s\2' failed.",linkID.c_str());
time_t server_uptime = ServerInstance->Time() - this->age;
if (server_uptime)
- ServerInstance->SNO->WriteGlobalSno('l', "Connection to '\2%s\2' was established for %s", quitserver.c_str(), Utils->Creator->TimeToStr(server_uptime).c_str());
+ ServerInstance->SNO->WriteGlobalSno('l', "Connection to '\2%s\2' was established for %s", linkID.c_str(), Utils->Creator->TimeToStr(server_uptime).c_str());
+ linkID.clear();
}
}
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index ab057570a..e0f2ff601 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -144,14 +144,13 @@ CullResult SpanningTreeUtilities::cull()
{
TreeSocket* sock = child_server->GetSocket();
sock->Close();
- ServerInstance->GlobalCulls.AddItem(sock);
}
}
for(std::map<TreeSocket*, std::pair<std::string, int> >::iterator i = timeoutlist.begin(); i != timeoutlist.end(); ++i)
{
TreeSocket* s = i->first;
- ServerInstance->GlobalCulls.AddItem(s);
+ s->Close();
}
TreeRoot->cull();