summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_httpd.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index 37f715a8d..6315809a9 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -32,6 +32,7 @@ class ModuleHttpServer;
static ModuleHttpServer* HttpModule;
static bool claimed;
+static std::set<HttpServerSocket*> sockets;
/** HTTP socket states
*/
@@ -69,6 +70,11 @@ class HttpServerSocket : public BufferedSocket
GetIOHook()->OnStreamSocketAccept(this, client, server);
}
+ ~HttpServerSocket()
+ {
+ sockets.erase(this);
+ }
+
virtual void OnError(BufferedSocketError)
{
ServerInstance->GlobalCulls.AddItem(this);
@@ -333,7 +339,6 @@ class HttpServerSocket : public BufferedSocket
class ModuleHttpServer : public Module
{
- std::vector<HttpServerSocket *> httpsocks;
public:
void init()
@@ -358,18 +363,21 @@ class ModuleHttpServer : public Module
int port;
std::string incomingip;
irc::sockets::satoap(*client, incomingip, port);
- new HttpServerSocket(nfd, incomingip, from, client, server);
+ sockets.insert(new HttpServerSocket(nfd, incomingip, from, client, server));
return MOD_RES_ALLOW;
}
-
- virtual ~ModuleHttpServer()
+ CullResult cull()
{
- for (size_t i = 0; i < httpsocks.size(); i++)
+ std::set<HttpServerSocket*> local;
+ local.swap(sockets);
+ for (std::set<HttpServerSocket*>::const_iterator i = local.begin(); i != local.end(); ++i)
{
- httpsocks[i]->cull();
- delete httpsocks[i];
+ HttpServerSocket* sock = *i;
+ sock->cull();
+ delete sock;
}
+ return Module::cull();
}
virtual Version GetVersion()