summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-16 13:45:46 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-16 13:45:46 +0000
commit3626aeb9ce4798c73cf3a5621388406062c450f7 (patch)
treef0d056cf4cb9ee8143d91d577047463c83bc31d9 /src/modules
parent423d9be3b1d09607ce82d09dbb6414a8b5f006c8 (diff)
Fix iteration of ServerInstance->Users->local_users now that QuitUser can modify the vector
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11732 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_close.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp
index e81c29d20..009d50d46 100644
--- a/src/modules/m_close.cpp
+++ b/src/modules/m_close.cpp
@@ -37,12 +37,14 @@ class CommandClose : public Command
{
std::map<std::string,int> closed;
- for (std::vector<User*>::iterator u = ServerInstance->Users->local_users.begin(); u != ServerInstance->Users->local_users.end(); u++)
+ std::vector<User*>::reverse_iterator u = ServerInstance->Users->local_users.rbegin();
+ while (u != ServerInstance->Users->local_users.rend())
{
- if ((*u)->registered != REG_ALL)
+ User* user = *u++;
+ if (user->registered != REG_ALL)
{
- ServerInstance->Users->QuitUser(*u, "Closing all unknown connections per request");
- std::string key = ConvToStr((*u)->GetIPString())+"."+ConvToStr((*u)->GetServerPort());
+ ServerInstance->Users->QuitUser(user, "Closing all unknown connections per request");
+ std::string key = ConvToStr(user->GetIPString())+"."+ConvToStr(user->GetServerPort());
closed[key]++;
}
}