]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Cull ident sockets instead of immediate delete, add stdalgo::culldeleter
authorAttila Molnar <attilamolnar@hush.com>
Mon, 24 Mar 2014 15:44:04 +0000 (16:44 +0100)
committerAttila Molnar <attilamolnar@hush.com>
Mon, 24 Mar 2014 15:44:04 +0000 (16:44 +0100)
include/inspircd.h
include/stdalgo.h
src/modules/m_ident.cpp

index bf3cb06b0e47411abe5693af81fb44969b9bdfb1..db13b2ab34414c493f0edda12819427d0b9c5538 100644 (file)
@@ -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);
+}
index 3cbb8635021e05042ccd4611450567c1ff90983a..1ae5b8ae1098919779a4414b47ba343651750af6 100644 (file)
@@ -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);
+       };
 }
index 67065bd6226c8c5ea12a4638a62a832a278609f0..57944737ca9777447c6c93d4530af501cddc837f 100644 (file)
@@ -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)
        {