Add ApiListener::UpdatedObjectAuthority()

refs #7086
This commit is contained in:
Alexander A. Klimov 2019-07-08 16:41:47 +02:00 committed by Michael Friedrich
parent 60661eaecb
commit 3f4cb0936c
2 changed files with 12 additions and 0 deletions

View 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);
}

View 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();