summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2009-01-27 13:21:47 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2009-01-27 13:21:47 +0000
commitf5e34251d3e85d1e3cee23b418dc17e4b6cca3b3 (patch)
tree26c554a9f3696251e9bf037634a2a569ec924fe4
parentb21e2d1c1665bcffb9c86fb3d170247f026737ad (diff)
Check line expiry when touching an xline, to prevent huge buildup of stale lines chomping CPU.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11007 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/xline.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/xline.cpp b/src/xline.cpp
index c696e7a3a..25987e0a2 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -261,20 +261,17 @@ XLine* XLineManager::MatchesLine(const std::string &type, User* user)
safei = i;
safei++;
+ if (i->second->duration && current > i->second->expiry)
+ {
+ /* Expire the line, proceed to next one */
+ ExpireLine(x, i);
+ i = safei;
+ continue;
+ }
+
if (i->second->Matches(user))
{
- if (i->second->duration && current > i->second->expiry)
- {
- /* Expire the line, return nothing */
- ExpireLine(x, i);
- /* Continue, there may be another that matches
- * (thanks aquanight)
- */
- i = safei;
- continue;
- }
- else
- return i->second;
+ return i->second;
}
i = safei;