summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index 2fce9a504..7d8abf4bf 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -140,23 +140,18 @@ void TreeServer::FinishBurst()
int TreeServer::QuitUsers(const std::string &reason)
{
std::string publicreason = ServerInstance->Config->HideSplits ? "*.net *.split" : reason;
- std::vector<User*> time_to_die;
- for (user_hash::iterator n = ServerInstance->Users->clientlist->begin(); n != ServerInstance->Users->clientlist->end(); n++)
- {
- if (n->second->server == ServerName)
- {
- time_to_die.push_back(n->second);
- }
- }
- for (std::vector<User*>::iterator n = time_to_die.begin(); n != time_to_die.end(); n++)
+
+ const user_hash& users = *ServerInstance->Users->clientlist;
+ unsigned int original_size = users.size();
+ for (user_hash::const_iterator i = users.begin(); i != users.end(); )
{
- User* a = (User*)*n;
- if (!IS_LOCAL(a))
- {
- ServerInstance->Users->QuitUser(a, publicreason, &reason);
- }
+ User* user = i->second;
+ // Increment the iterator now because QuitUser() removes the user from the container
+ ++i;
+ if (user->server == ServerName)
+ ServerInstance->Users->QuitUser(user, publicreason, &reason);
}
- return time_to_die.size();
+ return original_size - users.size();
}
/** This method is used to add the structure to the