diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-11-03 15:43:49 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-11-03 15:43:49 +0100 |
commit | ce3ce6cd49e14f640a1cabfef9cf21a239dd961d (patch) | |
tree | 3131cec6d690245f64c5e88faf37a776233e3881 /src | |
parent | f3d80041f68417cc10d8e7575659468b30009f22 (diff) |
m_flashpolicyd, m_httpd Store sockets in a intrusive list
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_flashpolicyd.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_httpd.cpp | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/modules/m_flashpolicyd.cpp b/src/modules/m_flashpolicyd.cpp index 6466a9fb2..8f847e111 100644 --- a/src/modules/m_flashpolicyd.cpp +++ b/src/modules/m_flashpolicyd.cpp @@ -23,12 +23,12 @@ class FlashPDSocket; namespace { - std::set<FlashPDSocket*> sockets; + insp::intrusive_list<FlashPDSocket> sockets; std::string policy_reply; const std::string expected_request("<policy-file-request/>\0", 23); } -class FlashPDSocket : public BufferedSocket, public Timer +class FlashPDSocket : public BufferedSocket, public Timer, public insp::intrusive_list_node<FlashPDSocket> { /** True if this object is in the cull list */ @@ -90,7 +90,7 @@ class ModuleFlashPD : public Module if (policy_reply.empty()) return MOD_RES_DENY; - sockets.insert(new FlashPDSocket(nfd, timeout)); + sockets.push_front(new FlashPDSocket(nfd, timeout)); return MOD_RES_ALLOW; } @@ -148,7 +148,7 @@ class ModuleFlashPD : public Module CullResult cull() { - for (std::set<FlashPDSocket*>::const_iterator i = sockets.begin(); i != sockets.end(); ++i) + for (insp::intrusive_list<FlashPDSocket>::const_iterator i = sockets.begin(); i != sockets.end(); ++i) { FlashPDSocket* sock = *i; sock->AddToCull(); diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 30612f644..a4452c9c0 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -30,7 +30,7 @@ class ModuleHttpServer; static ModuleHttpServer* HttpModule; static bool claimed; -static std::set<HttpServerSocket*> sockets; +static insp::intrusive_list<HttpServerSocket> sockets; /** HTTP socket states */ @@ -43,7 +43,7 @@ enum HttpState /** A socket used for HTTP transport */ -class HttpServerSocket : public BufferedSocket, public Timer +class HttpServerSocket : public BufferedSocket, public Timer, public insp::intrusive_list_node<HttpServerSocket> { HttpState InternalState; std::string ip; @@ -397,13 +397,13 @@ class ModuleHttpServer : public Module int port; std::string incomingip; irc::sockets::satoap(*client, incomingip, port); - sockets.insert(new HttpServerSocket(nfd, incomingip, from, client, server, timeoutsec)); + sockets.push_front(new HttpServerSocket(nfd, incomingip, from, client, server, timeoutsec)); return MOD_RES_ALLOW; } CullResult cull() CXX11_OVERRIDE { - for (std::set<HttpServerSocket*>::const_iterator i = sockets.begin(); i != sockets.end(); ++i) + for (insp::intrusive_list<HttpServerSocket>::const_iterator i = sockets.begin(); i != sockets.end(); ++i) { HttpServerSocket* sock = *i; sock->AddToCull(); |