/* Close all client sockets, or the new process inherits them */
const UserManager::LocalList& list = Users.GetLocalUsers();
- for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
- Users->QuitUser(*i, "Server shutdown");
+ while (!list.empty())
+ Users->QuitUser(list.front(), "Server shutdown");
GlobalCulls.Apply();
Modules->UnloadAll();
std::map<std::string,int> closed;
const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
- for (UserManager::LocalList::const_iterator u = list.begin(); u != list.end(); ++u)
+ for (UserManager::LocalList::const_iterator u = list.begin(); u != list.end(); )
{
+ // Quitting the user removes it from the list
LocalUser* user = *u;
+ ++u;
if (user->registered != REG_ALL)
{
ServerInstance->Users->QuitUser(user, "Closing all unknown connections per request");
{
/* Redirect everyone but the oper sending the command */
const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
- for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
+ for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); )
{
+ // Quitting the user removes it from the list
LocalUser* t = *i;
+ ++i;
if (!t->IsOper())
{
t->WriteNumeric(RPL_REDIR, "%s %d :Please use this Server/Port instead", parameters[0].c_str(), GetPort(t));
return;
const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
- for (UserManager::LocalList::const_iterator iter = list.begin(); iter != list.end(); ++iter)
+ for (UserManager::LocalList::const_iterator iter = list.begin(); iter != list.end(); )
{
/* Fix by Brain: Dont quit UID users */
+ // Quitting the user removes it from the list
User* n = *iter;
+ ++iter;
if (!isdigit(n->nick[0]) && !ServerInstance->IsNick(n->nick))
ServerInstance->Users->QuitUser(n, message);
}