]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix crash on unload of modules with listening sockets -- some situations require...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 23 Jul 2007 23:10:16 +0000 (23:10 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 23 Jul 2007 23:10:16 +0000 (23:10 +0000)
Also squish some silly error output on unloading spanningtree.

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7529 e03df62e-2008-0410-955e-edbf42e46eb7

include/inspircd.h
src/inspircd.cpp
src/modules/m_httpd.cpp
src/modules/m_spanningtree/treesocket1.cpp
src/modules/m_spanningtree/treesocket2.cpp
src/modules/m_spanningtree/utils.cpp

index c3f8ed328321c3be9fa40c35779b3a240a6a7b0e..79d3ae7eddfb406fb4f1235cee9dac870d1380df 100644 (file)
@@ -1273,6 +1273,11 @@ class CoreExport InspIRCd : public classbase
         * @return The return value for this function is undefined.
         */
        int Run();
+
+       /** Force all InspSockets to be removed which are due to
+        * be culled.
+        */
+       void InspSocketCull();
 };
 
 #endif
index dbfbc17972865cb85b974d9aa02515a63492a4e6..c35bf32c3dcc8bfc2b11d70af3801a22d51ae7af 100644 (file)
@@ -1122,6 +1122,11 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
        GlobalCulls.Apply();
 
        /* If any inspsockets closed, remove them */
+       this->InspSocketCull();
+}
+
+void InspIRCd::InspSocketCull()
+{
        for (std::map<InspSocket*,InspSocket*>::iterator x = SocketCull.begin(); x != SocketCull.end(); ++x)
        {
                SE->DelFd(x->second);
index 8494863a3f4b4597471d6e6181936536b009e271..0e06f5363208f0d325fa5eb7a121dc0d4a9d326b 100644 (file)
@@ -405,9 +405,10 @@ class ModuleHttpServer : public Module
                for (size_t i = 0; i < httpsocks.size(); i++)
                {
                        ServerInstance->SE->DelFd(httpsocks[i]);
+                       httpsocks[i]->Close();
                        delete httpsocks[i]->GetIndex();
-                       delete httpsocks[i];
                }
+               ServerInstance->InspSocketCull();
        }
 
        virtual Version GetVersion()
index 4d960cf8a55ad9c8fce6ca91c7ae0abfe8e29aa5..c987cb59040f35c7ea034d40d76ba699e6e7c408 100644 (file)
@@ -212,6 +212,9 @@ void TreeSocket::OnError(InspSocketError e)
 {
        Link* MyLink;
 
+       if (this->LinkState == LISTENER)
+               return;
+
        switch (e)
        {
                case I_ERR_CONNECT:
index dcfb2b4aad05bb60e94167d17792f0fad436ec76..23362ca9932dc6bf8c07ef5f8030290f7714cd57 100644 (file)
@@ -1501,6 +1501,9 @@ void TreeSocket::OnTimeout()
 
 void TreeSocket::OnClose()
 {
+       if (this->LinkState == LISTENER)
+               return;
+
        // Connection closed.
        // If the connection is fully up (state CONNECTED)
        // then propogate a netsplit to all peers.
index 9d4fbf41a3c19c4d2c7555d2fbccc30e4abf9e3a..bfd46ef03d53a0078c66b51bc5c7658534d31ccc 100644 (file)
@@ -202,6 +202,7 @@ SpanningTreeUtilities::~SpanningTreeUtilities()
                }
        }
        delete TreeRoot;
+       ServerInstance->InspSocketCull();
 }
 
 void SpanningTreeUtilities::AddThisServer(TreeServer* server, TreeServerList &list)