summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-03-24 16:44:04 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-03-24 16:44:04 +0100
commitfacea197311f9dfbd9401b32b18cfd1245ff9be4 (patch)
tree4c46c2cae6ee83898449829e4101b3b2d5b5c3cd
parent6d9b2bfee07c906699faef4de5ad85787978be3a (diff)
Cull ident sockets instead of immediate delete, add stdalgo::culldeleter
-rw-r--r--include/inspircd.h6
-rw-r--r--include/stdalgo.h9
-rw-r--r--src/modules/m_ident.cpp2
3 files changed, 16 insertions, 1 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index bf3cb06b0..db13b2ab3 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -672,3 +672,9 @@ class CommandModule : public Module
return Version(cmd.name, VF_VENDOR|VF_CORE);
}
};
+
+inline void stdalgo::culldeleter::operator()(classbase* item)
+{
+ if (item)
+ ServerInstance->GlobalCulls.AddItem(item);
+}
diff --git a/include/stdalgo.h b/include/stdalgo.h
index 3cbb86350..1ae5b8ae1 100644
--- a/include/stdalgo.h
+++ b/include/stdalgo.h
@@ -75,4 +75,13 @@ namespace stdalgo
delete o;
}
};
+
+ /**
+ * Deleter that adds the item to the cull list, that is, queues it for
+ * deletion at the end of the current mainloop iteration
+ */
+ struct culldeleter
+ {
+ void operator()(classbase* item);
+ };
}
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index 67065bd62..57944737c 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -268,7 +268,7 @@ class IdentRequestSocket : public EventHandler
class ModuleIdent : public Module
{
int RequestTimeout;
- SimpleExtItem<IdentRequestSocket> ext;
+ SimpleExtItem<IdentRequestSocket, stdalgo::culldeleter> ext;
public:
ModuleIdent() : ext("ident_socket", this)
{