From: Gunnar Beutner Date: Wed, 13 Jan 2016 09:30:38 +0000 (+0100) Subject: Ensure that HttpServerConnections are properly closed X-Git-Tag: v2.4.2~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b6a799d53e66f2c7d5478b6a2ca0615a407916a5;p=icinga2 Ensure that HttpServerConnections are properly closed fixes #10655 --- diff --git a/lib/base/tlsstream.cpp b/lib/base/tlsstream.cpp index 8f27bb6a0..be1977e5b 100644 --- a/lib/base/tlsstream.cpp +++ b/lib/base/tlsstream.cpp @@ -318,13 +318,17 @@ void TlsStream::Shutdown(void) */ void TlsStream::Close(void) { + if (!m_Eof) { + m_Eof = true; + SignalDataAvailable(); + } + Stream::Close(); SocketEvents::Unregister(); boost::mutex::scoped_lock lock(m_Mutex); - m_Eof = true; if (!m_SSL) return; diff --git a/lib/remote/httpserverconnection.cpp b/lib/remote/httpserverconnection.cpp index 409b6f26e..d857ed4bf 100644 --- a/lib/remote/httpserverconnection.cpp +++ b/lib/remote/httpserverconnection.cpp @@ -216,6 +216,12 @@ void HttpServerConnection::DataAvailableHandler(void) if (close) Disconnect(); + + return; + } + + if (m_Stream->IsEof()) + Disconnect(); } void HttpServerConnection::CheckLiveness(void) diff --git a/lib/remote/jsonrpcconnection.cpp b/lib/remote/jsonrpcconnection.cpp index 81911c300..6bfd27ced 100644 --- a/lib/remote/jsonrpcconnection.cpp +++ b/lib/remote/jsonrpcconnection.cpp @@ -249,6 +249,12 @@ void JsonRpcConnection::DataAvailableHandler(void) if (close) Disconnect(); + + return; + } + + if (m_Stream->IsEof()) + Disconnect(); } Value SetLogPositionHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)