diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_httpd.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index bdb1d50fc..978a60ab7 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -95,7 +95,7 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru { if (!messagecomplete) { - AddToCull(); + Close(); return false; } @@ -229,7 +229,7 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru // IOHook may have errored if (!getError().empty()) { - AddToCull(); + Close(); return; } } @@ -244,9 +244,19 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru sockets.erase(this); } + void Close() CXX11_OVERRIDE + { + if (waitingcull || !HasFd()) + return; + + waitingcull = true; + BufferedSocket::Close(); + ServerInstance->GlobalCulls.AddItem(this); + } + void OnError(BufferedSocketError) CXX11_OVERRIDE { - AddToCull(); + Close(); } void SendHTTPError(unsigned int response) @@ -315,7 +325,7 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru { SendHeaders(s.length(), response, *hheaders); WriteData(s); - Close(true); + BufferedSocket::Close(true); } void Page(std::stringstream* n, unsigned int response, HTTPHeaders* hheaders) @@ -323,16 +333,6 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru Page(n->str(), response, hheaders); } - void AddToCull() - { - if (waitingcull) - return; - - waitingcull = true; - Close(); - ServerInstance->GlobalCulls.AddItem(this); - } - bool ParseURI(const std::string& uristr, HTTPRequestURI& out) { http_parser_url_init(&url); @@ -439,7 +439,7 @@ class ModuleHttpServer : public Module for (insp::intrusive_list<HttpServerSocket>::const_iterator i = sockets.begin(); i != sockets.end(); ++i) { HttpServerSocket* sock = *i; - sock->AddToCull(); + sock->Close(); } return Module::cull(); } |