]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_httpd.cpp
Support SASL messages other than 'C' and 'D'
[user/henk/code/inspircd.git] / src / modules / m_httpd.cpp
index 37f715a8da221914b3d54a44c0556193e5796b93..6315809a9f8a6c4d4335b25a8a5551e10abc27f9 100644 (file)
@@ -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()