diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-02 03:15:46 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-02 03:15:46 +0000 |
commit | 8456cf5ccd44911f4e56538fe0880dd7fc7cd96d (patch) | |
tree | 3e1f96b94cc86506a615d8b39131ff6ea7c1b64c /src/modules | |
parent | 87d031609bb8b7d2cd186d8f24bcb853fd93798c (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')
-rw-r--r-- | src/modules/m_lockserv.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_nokicks.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_ojoin.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_spanningtree/opertype.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treeserver.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket.h | 1 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket1.cpp | 11 | ||||
-rw-r--r-- | src/modules/m_spanningtree/uid.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 1 |
10 files changed, 22 insertions, 16 deletions
diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index 78c15dead..fa5fc3a3f 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -33,7 +33,7 @@ public: CmdResult Handle (const std::vector<std::string> ¶meters, User *user) { locked = true; - user->WriteNumeric(988, "%s %s :Closed for new connections", user->nick.c_str(), user->server); + user->WriteNumeric(988, "%s %s :Closed for new connections", user->nick.c_str(), user->server.c_str()); ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used LOCKSERV to temporarily close for new connections", user->nick.c_str()); /* Dont send to the network */ return CMD_SUCCESS; @@ -54,7 +54,7 @@ public: CmdResult Handle (const std::vector<std::string> ¶meters, User *user) { locked = false; - user->WriteNumeric(989, "%s %s :Open for new connections", user->nick.c_str(), user->server); + user->WriteNumeric(989, "%s %s :Open for new connections", user->nick.c_str(), user->server.c_str()); ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used UNLOCKSERV to allow for new connections", user->nick.c_str()); /* Dont send to the network */ return CMD_SUCCESS; diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index db77184d6..0a9ce2edf 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -44,7 +44,7 @@ class ModuleNoKicks : public Module { if (!memb->chan->GetExtBanStatus(source, 'Q').check(!memb->chan->IsModeSet('Q'))) { - if ((ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server)) + if ((ServerInstance->ULine(source->nick.c_str())) || ServerInstance->ULine(source->server)) { // ulines can still kick with +Q in place return MOD_RES_PASSTHRU; diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index 8b8c1401e..c4ba99779 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -212,7 +212,6 @@ class NetworkPrefix : public ModeHandler ((source == theuser) && (!adding)) || (ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || - (!*source->server) || (!IS_LOCAL(source)) ) { @@ -289,7 +288,7 @@ class ModuleOjoin : public Module ModResult OnUserPreKick(User* source, Membership* memb, const std::string &reason) { - if ((ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server)) + if ((ServerInstance->ULine(source->nick.c_str())) || ServerInstance->ULine(source->server)) return MOD_RES_PASSTHRU; // Don't do anything if they're not +Y 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 ¶ms) } 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 ¶ms) 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); } } |