mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Stability fix
git-svn-id: http://svn.inspircd.org/repository/branches/1_0_stable@4452 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
283fdc99a8
commit
684d0250a4
@ -341,24 +341,21 @@ void DoBackgroundUserStuff(time_t TIME)
|
||||
{
|
||||
CullList GlobalGoners;
|
||||
|
||||
size_t f = local_users.size();
|
||||
int cfd = 0;
|
||||
|
||||
for (std::vector<userrec*>::iterator count2 = local_users.begin(); count2 != local_users.end(); count2++)
|
||||
/* XXX: IT IS NOT SAFE TO USE AN ITERATOR HERE. DON'T EVEN THINK ABOUT IT. */
|
||||
for (unsigned long count2 = 0; count2 != local_users.size(); count2++)
|
||||
{
|
||||
/* GRONK */
|
||||
if (f != local_users.size())
|
||||
if (count2 >= local_users.size())
|
||||
break;
|
||||
|
||||
/* Sanity checks for corrupted iterators (yes, really) */
|
||||
userrec* curr = NULL;
|
||||
|
||||
if (*count2)
|
||||
curr = (userrec*)(*count2);
|
||||
if ((long)curr == -1)
|
||||
return;
|
||||
userrec* curr = local_users[count2];
|
||||
|
||||
if (curr)
|
||||
{
|
||||
cfd = curr->fd;
|
||||
|
||||
/*
|
||||
* registration timeout -- didnt send USER/NICK/HOST
|
||||
* in the time specified in their connection class.
|
||||
@ -407,20 +404,18 @@ void DoBackgroundUserStuff(time_t TIME)
|
||||
curr->nping = TIME+curr->pingmax;
|
||||
}
|
||||
|
||||
/* GANK */
|
||||
if (f != local_users.size())
|
||||
break;
|
||||
|
||||
/*
|
||||
* We can flush the write buffer as the last thing we do, because if they
|
||||
* match any of the above conditions its no use flushing their buffer anyway.
|
||||
*/
|
||||
curr->FlushWriteBuf();
|
||||
|
||||
if (*curr->GetWriteError())
|
||||
if ((cfd > 0) && (cfd < MAX_DESCRIPTORS) && (fd_ref_table[cfd] == curr) && (curr))
|
||||
{
|
||||
GlobalGoners.AddItem(curr,curr->GetWriteError());
|
||||
continue;
|
||||
curr->FlushWriteBuf();
|
||||
if (*curr->GetWriteError())
|
||||
{
|
||||
GlobalGoners.AddItem(curr,curr->GetWriteError());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user