diff options
| author | 2006-07-19 20:17:14 +0000 | |
|---|---|---|
| committer | 2006-07-19 20:17:14 +0000 | |
| commit | 684d0250a465ab096a7dec4f67bd2d4620cec54a (patch) | |
| tree | c39be2aeca5d151f695197a6834bf4f61d3c37f6 /src/userprocess.cpp | |
| parent | Safties (diff) | |
Stability fix
git-svn-id: http://svn.inspircd.org/repository/branches/1_0_stable@4452 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/userprocess.cpp')
| -rw-r--r-- | src/userprocess.cpp | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 9ae68cbfd..237cd61bb 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -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; + } } } } |
