diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-07-23 23:10:16 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-07-23 23:10:16 +0000 |
commit | f12fd5382fef6aa5c6f75b2614460089a9af9f27 (patch) | |
tree | 71d48061564c7de3a9c6050a3a2ace97dd70e142 | |
parent | 05670eb4a92765ec954f81e775419cff7efcd87c (diff) |
Fix crash on unload of modules with listening sockets -- some situations require that the socket cull list is purged *immediately*, provide facility for this.
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
-rw-r--r-- | include/inspircd.h | 5 | ||||
-rw-r--r-- | src/inspircd.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_httpd.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket1.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 1 |
6 files changed, 19 insertions, 1 deletions
diff --git a/include/inspircd.h b/include/inspircd.h index c3f8ed328..79d3ae7ed 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -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 diff --git a/src/inspircd.cpp b/src/inspircd.cpp index dbfbc1797..c35bf32c3 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -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); diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 8494863a3..0e06f5363 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -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() diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 4d960cf8a..c987cb590 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -212,6 +212,9 @@ void TreeSocket::OnError(InspSocketError e) { Link* MyLink; + if (this->LinkState == LISTENER) + return; + switch (e) { case I_ERR_CONNECT: diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index dcfb2b4aa..23362ca99 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -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. diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 9d4fbf41a..bfd46ef03 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -202,6 +202,7 @@ SpanningTreeUtilities::~SpanningTreeUtilities() } } delete TreeRoot; + ServerInstance->InspSocketCull(); } void SpanningTreeUtilities::AddThisServer(TreeServer* server, TreeServerList &list) |