summaryrefslogtreecommitdiff
path: root/src/xline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/xline.cpp')
-rw-r--r--src/xline.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/xline.cpp b/src/xline.cpp
index b41b69c89..c44bf9017 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -73,10 +73,18 @@ void XLineManager::CheckELines()
{
User* u = (User*)(*u2);
- for (LookupIter i = ELines.begin(); i != ELines.end(); i++)
+ /* This uses safe iteration to ensure that if a line expires here, it doenst trash the iterator */
+ LookupIter safei;
+
+ for (LookupIter i = ELines.begin(); i != ELines.end(); )
{
+ safei = i;
+ safei++;
+
XLine *e = i->second;
u->exempt = e->Matches(u);
+
+ i = safei;
}
}
}
@@ -89,6 +97,21 @@ XLineLookup* XLineManager::GetAll(const std::string &type)
if (n == lookup_lines.end())
return NULL;
+ LookupIter safei;
+ const time_t current = ServerInstance->Time();
+
+ /* Expire any dead ones, before sending */
+ for (LookupIter x = n->second.begin(); x != n->second.end(); )
+ {
+ safei = x;
+ safei++;
+ if (current > x->second->expiry)
+ {
+ ExpireLine(n, x);
+ }
+ x = safei;
+ }
+
return &(n->second);
}