]> granicus.if.org Git - icinga2/commitdiff
HttpServerConnection#DataAvailableHandler(): be aware of being called multiple times... 6817/head
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Mon, 3 Dec 2018 18:05:41 +0000 (19:05 +0100)
committerAlexander A. Klimov <alexander.klimov@icinga.com>
Mon, 3 Dec 2018 18:05:41 +0000 (19:05 +0100)
refs #6816

lib/remote/httpserverconnection.cpp

index 356a0ffba12b1d0dccf2a51e0bee5b7d85de00e2..88234e837a01b5a730472c91be65f50a7b67e906 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())