diff options
Diffstat (limited to 'src/modules/m_close.cpp')
-rw-r--r-- | src/modules/m_close.cpp | 10 |
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]++; } } |