From b6a799d53e66f2c7d5478b6a2ca0615a407916a5 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 13 Jan 2016 10:30:38 +0100 Subject: [PATCH] Ensure that HttpServerConnections are properly closed fixes #10655 --- lib/base/tlsstream.cpp | 6 +++++- lib/remote/httpserverconnection.cpp | 6 ++++++ lib/remote/jsonrpcconnection.cpp | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) 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) -- 2.50.1