]> granicus.if.org Git - icinga2/commitdiff
Ensure that HttpServerConnections are properly closed
authorGunnar Beutner <gunnar@beutner.name>
Wed, 13 Jan 2016 09:30:38 +0000 (10:30 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 23 Feb 2016 08:38:05 +0000 (09:38 +0100)
fixes #10655

lib/base/tlsstream.cpp
lib/remote/httpserverconnection.cpp
lib/remote/jsonrpcconnection.cpp

index 8f27bb6a0810e431c953bbc6c4e2deb6413d8a59..be1977e5befcddb246ffbf7b8bdd6a0e3bd041f8 100644 (file)
@@ -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;
index 409b6f26e14528135e03674f3cfa6ea968096463..d857ed4bfa1086a733c664eb7d85fe25ca89ad26 100644 (file)
@@ -216,6 +216,12 @@ void HttpServerConnection::DataAvailableHandler(void)
 
        if (close)
                Disconnect();
+
+               return;
+       }
+
+       if (m_Stream->IsEof())
+               Disconnect();
 }
 
 void HttpServerConnection::CheckLiveness(void)
index 81911c30064efc46b640dd6405e900415828e560..6bfd27ced85f4b7666fae1f9a2d3d71ae2b789fa 100644 (file)
@@ -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)