]> granicus.if.org Git - icinga2/commitdiff
HttpServerConnection#DataAvailableHandler(): be aware of being called multiple times...
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Mon, 3 Dec 2018 18:05:41 +0000 (19:05 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 5 Dec 2018 14:46:32 +0000 (15:46 +0100)
refs #6816

lib/remote/httpserverconnection.cpp

index cd3e542f27761d16d1ff34406d4f2d9103b46658..c0550bfaeafa2a58d892a34b495dfe31f8eea770 100644 (file)
@@ -351,7 +351,11 @@ void HttpServerConnection::DataAvailableHandler()
        bool close = false;
 
        if (!m_Stream->IsEof()) {
-               boost::recursive_mutex::scoped_lock lock(m_DataHandlerMutex);
+               boost::recursive_mutex::scoped_try_lock lock(m_DataHandlerMutex);
+               if (!lock.owns_lock()) {
+                       Log(LogInformation, "HttpServerConnection", "Unable to process available data, they're already being processed in another thread");
+                       return;
+               }
 
                try {
                        while (ProcessMessage())