From 3f4cb0936c5f9774aa4eb07504d138a237d64497 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 8 Jul 2019 16:41:47 +0200 Subject: [PATCH] Add ApiListener::UpdatedObjectAuthority() refs #7086 --- lib/remote/apilistener-authority.cpp | 4 ++++ lib/remote/apilistener.hpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/remote/apilistener-authority.cpp b/lib/remote/apilistener-authority.cpp index f3740dec5..d5fe5120c 100644 --- a/lib/remote/apilistener-authority.cpp +++ b/lib/remote/apilistener-authority.cpp @@ -8,6 +8,8 @@ using namespace icinga; +std::atomic 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); } diff --git a/lib/remote/apilistener.hpp b/lib/remote/apilistener.hpp index 0f552e984..ecbeed415 100644 --- a/lib/remote/apilistener.hpp +++ b/lib/remote/apilistener.hpp @@ -15,6 +15,7 @@ #include "base/tcpsocket.hpp" #include "base/tlsstream.hpp" #include "base/threadpool.hpp" +#include #include #include #include @@ -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 m_UpdatedObjectAuthority; void ApiTimerHandler(); void ApiReconnectTimerHandler();