]> granicus.if.org Git - icinga2/commitdiff
Add ApiListener::UpdatedObjectAuthority()
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Mon, 8 Jul 2019 14:41:47 +0000 (16:41 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Thu, 11 Jul 2019 10:58:07 +0000 (12:58 +0200)
refs #7086

lib/remote/apilistener-authority.cpp
lib/remote/apilistener.hpp

index f3740dec530682bd10b52c0e07b60eabf1231959..d5fe5120c7ee09a54132fd9d89d8ebfd26207e01 100644 (file)
@@ -8,6 +8,8 @@
 
 using namespace icinga;
 
+std::atomic<bool> ApiListener::m_UpdatedObjectAuthority (false);
+
 void ApiListener::UpdateObjectAuthority()
 {
        /* Always run this, even if there is no 'api' feature enabled. */
@@ -77,4 +79,6 @@ void ApiListener::UpdateObjectAuthority()
                        object->SetAuthority(authority);
                }
        }
+
+       m_UpdatedObjectAuthority.store(true);
 }
index 0f552e984898485edc72d32bfd42d1d83a5f66b9..ecbeed415efaf9e79e6aac25269577bea6a8b489 100644 (file)
@@ -15,6 +15,7 @@
 #include "base/tcpsocket.hpp"
 #include "base/tlsstream.hpp"
 #include "base/threadpool.hpp"
+#include <atomic>
 #include <boost/asio/ip/tcp.hpp>
 #include <boost/asio/spawn.hpp>
 #include <boost/asio/ssl/context.hpp>
@@ -104,6 +105,12 @@ public:
        static String GetDefaultKeyPath();
        static String GetDefaultCaPath();
 
+       static inline
+       bool UpdatedObjectAuthority()
+       {
+               return m_UpdatedObjectAuthority.load();
+       }
+
        double GetTlsHandshakeTimeout() const override;
        void SetTlsHandshakeTimeout(double value, bool suppress_events, const Value& cookie) override;
 
@@ -133,6 +140,7 @@ private:
        Endpoint::Ptr m_LocalEndpoint;
 
        static ApiListener::Ptr m_Instance;
+       static std::atomic<bool> m_UpdatedObjectAuthority;
 
        void ApiTimerHandler();
        void ApiReconnectTimerHandler();