summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-12-10 17:50:31 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-12-10 17:50:31 +0100
commite4167bc3a150116e4235cfa106ab72ee0d14faca (patch)
tree03aca3885a8701c1a39578ed9c0c83b1dbd8ef7f
parent7559c4316830b24c338096b96384d35877794125 (diff)
m_httpd On module unload close all connections hooked by the module being unloaded
-rw-r--r--src/modules/m_httpd.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index 2a430d967..2b079c6ff 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -348,7 +348,7 @@ class ModuleHttpServer : public Module
void init()
{
HttpModule = this;
- Implementation eventlist[] = { I_OnAcceptConnection, I_OnBackgroundTimer, I_OnRehash };
+ Implementation eventlist[] = { I_OnAcceptConnection, I_OnBackgroundTimer, I_OnRehash, I_OnUnloadModule };
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
OnRehash(NULL);
}
@@ -397,6 +397,20 @@ class ModuleHttpServer : public Module
}
}
+ void OnUnloadModule(Module* mod)
+ {
+ for (std::set<HttpServerSocket*>::const_iterator i = sockets.begin(); i != sockets.end(); )
+ {
+ HttpServerSocket* sock = *i;
+ ++i;
+ if (sock->GetIOHook() == mod)
+ {
+ sock->cull();
+ delete sock;
+ }
+ }
+ }
+
CullResult cull()
{
std::set<HttpServerSocket*> local;