summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-02 03:15:46 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-02 03:15:46 +0000
commit8456cf5ccd44911f4e56538fe0880dd7fc7cd96d (patch)
tree3e1f96b94cc86506a615d8b39131ff6ea7c1b64c /src/modules/m_spanningtree
parent87d031609bb8b7d2cd186d8f24bcb853fd93798c (diff)
Fix valgrind issues and crashes on exit
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11794 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/main.cpp10
-rw-r--r--src/modules/m_spanningtree/opertype.cpp2
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp2
-rw-r--r--src/modules/m_spanningtree/treesocket.h1
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp11
-rw-r--r--src/modules/m_spanningtree/uid.cpp2
-rw-r--r--src/modules/m_spanningtree/utils.cpp1
7 files changed, 18 insertions, 11 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index b0829cc1d..8b9f40e0b 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -368,6 +368,7 @@ void ModuleSpanningTree::DoConnectTimeout(time_t curtime)
failovers.push_back(s->myautoconnect);
Utils->timeoutlist.erase(me);
s->Close();
+ ServerInstance->GlobalCulls.AddItem(s);
}
}
for(unsigned int j=0; j < failovers.size(); j++)
@@ -963,7 +964,10 @@ void ModuleSpanningTree::OnEvent(Event* event)
bool ModuleSpanningTree::cull()
{
- return Utils->cull();
+ Utils->cull();
+ ServerInstance->Timers->DelTimer(RefreshTimer);
+ ServerInstance->Modules->DoneWithInterface("BufferedSocketHook");
+ return this->Module::cull();
}
ModuleSpanningTree::~ModuleSpanningTree()
@@ -976,10 +980,6 @@ ModuleSpanningTree::~ModuleSpanningTree()
delete command_rconnect;
delete command_rsquit;
-
- ServerInstance->Timers->DelTimer(RefreshTimer);
-
- ServerInstance->Modules->DoneWithInterface("BufferedSocketHook");
}
Version ModuleSpanningTree::GetVersion()
diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp
index a1ad88007..38b621fb5 100644
--- a/src/modules/m_spanningtree/opertype.cpp
+++ b/src/modules/m_spanningtree/opertype.cpp
@@ -57,7 +57,7 @@ bool TreeSocket::OperType(const std::string &prefix, parameterlist &params)
}
if (dosend)
- ServerInstance->SNO->WriteToSnoMask('O',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server, u->nick.c_str(),u->ident.c_str(), u->host.c_str(), irc::Spacify(opertype.c_str()));
+ 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(), irc::Spacify(opertype.c_str()));
}
return true;
}
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index ffc533daf..95f686698 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -164,7 +164,7 @@ int TreeServer::QuitUsers(const std::string &reason)
std::vector<User*> time_to_die;
for (user_hash::iterator n = ServerInstance->Users->clientlist->begin(); n != ServerInstance->Users->clientlist->end(); n++)
{
- if (!strcmp(n->second->server, this->ServerName.c_str()))
+ if (n->second->server == ServerName)
{
time_to_die.push_back(n->second);
}
diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h
index 3744de96b..b29a0480c 100644
--- a/src/modules/m_spanningtree/treesocket.h
+++ b/src/modules/m_spanningtree/treesocket.h
@@ -136,6 +136,7 @@ class TreeSocket : public BufferedSocket
*/
void CleanNegotiationInfo();
+ bool cull();
/** Destructor
*/
~TreeSocket();
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index ad15a33c8..70046d774 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -70,7 +70,7 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, int newfd, char* ip, Autocon
ServerInstance->Timers->AddTimer(hstimer);
/* Fix by Brain - inbound sockets need a timeout, too. 30 secs should be pleanty */
- Utils->timeoutlist[this] = std::pair<std::string, int>("<unknown>", 30);
+ Utils->timeoutlist[this] = std::pair<std::string, int>("<from " + std::string(ip) + ">", 30);
}
ServerState TreeSocket::GetLinkState()
@@ -88,13 +88,18 @@ void TreeSocket::CleanNegotiationInfo()
OutboundPass.clear();
}
-TreeSocket::~TreeSocket()
+bool TreeSocket::cull()
{
if (GetIOHook())
BufferedSocketUnhookRequest(this, Utils->Creator, GetIOHook()).Send();
+ Utils->timeoutlist.erase(this);
+ return this->BufferedSocket::cull();
+}
+
+TreeSocket::~TreeSocket()
+{
if (hstimer)
ServerInstance->Timers->DelTimer(hstimer);
- Utils->timeoutlist.erase(this);
}
/** When an outbound connection finishes connecting, we receive
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp
index f1a4e6256..96ca2236d 100644
--- a/src/modules/m_spanningtree/uid.cpp
+++ b/src/modules/m_spanningtree/uid.cpp
@@ -168,7 +168,7 @@ bool TreeSocket::ParseUID(const std::string &source, parameterlist &params)
dosend = false;
if (dosend)
- ServerInstance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s!%s@%s [%s] [%s]", _new->server, _new->nick.c_str(), _new->ident.c_str(), _new->host.c_str(), _new->GetIPString(), _new->fullname.c_str());
+ ServerInstance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s!%s@%s [%s] [%s]", _new->server.c_str(), _new->nick.c_str(), _new->ident.c_str(), _new->host.c_str(), _new->GetIPString(), _new->fullname.c_str());
params[params.size() - 1] = ":" + params[params.size() - 1];
Utils->DoOneToAllButSender(source, "UID", params, source);
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 7b6ea1565..3cdd495aa 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -171,6 +171,7 @@ bool SpanningTreeUtilities::cull()
{
TreeSocket* sock = child_server->GetSocket();
sock->Close();
+ ServerInstance->GlobalCulls.AddItem(sock);
}
}