From b3b2eb856b6c24b890705aaa197c3672674dbf05 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 8 Feb 2016 13:15:24 +0100 Subject: [PATCH] Make sure the "syncing" attribute is set to false refs #11083 --- lib/icinga/checkable-check.cpp | 6 ------ lib/icinga/checkable.hpp | 2 -- lib/remote/apilistener.cpp | 14 +++++++++++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index 762bc0c68..3c29a5b50 100644 --- a/lib/icinga/checkable-check.cpp +++ b/lib/icinga/checkable-check.cpp @@ -364,12 +364,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", ""); } -bool Checkable::IsCheckPending(void) const -{ - ObjectLock olock(this); - return m_CheckRunning; -} - void Checkable::ExecuteRemoteCheck(const Dictionary::Ptr& resolvedMacros) { CONTEXT("Executing remote check for object '" + GetName() + "'"); diff --git a/lib/icinga/checkable.hpp b/lib/icinga/checkable.hpp index 9ce25dbd1..cef114733 100644 --- a/lib/icinga/checkable.hpp +++ b/lib/icinga/checkable.hpp @@ -104,8 +104,6 @@ public: Endpoint::Ptr GetCommandEndpoint(void) const; - bool IsCheckPending(void) const; - static double CalculateExecutionTime(const CheckResult::Ptr& cr); static double CalculateLatency(const CheckResult::Ptr& cr); diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 32c3499bd..6d4e5871f 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -406,8 +406,11 @@ void ApiListener::SyncClient(const JsonRpcConnection::Ptr& aclient, const Endpoi Log(LogInformation, "ApiListener") << "Finished sending config updates for endpoint '" << endpoint->GetName() << "'."; - if (!needSync) + if (!needSync) { + ObjectLock olock2(endpoint); + endpoint->SetSyncing(false); return; + } Log(LogInformation, "ApiListener") << "Sending replay log for endpoint '" << endpoint->GetName() << "'."; @@ -416,8 +419,10 @@ void ApiListener::SyncClient(const JsonRpcConnection::Ptr& aclient, const Endpoi Log(LogInformation, "ApiListener") << "Finished sending replay log for endpoint '" << endpoint->GetName() << "'."; - } catch (const std::exception& ex) { + ObjectLock olock2(endpoint); + endpoint->SetSyncing(false); + Log(LogCritical, "ApiListener") << "Error while syncing endpoint '" << endpoint->GetName() << "': " << DiagnosticInformation(ex); } @@ -806,8 +811,11 @@ void ApiListener::ReplayLog(const JsonRpcConnection::Ptr& client) Zone::Ptr target_zone = target_endpoint->GetZone(); - if (!target_zone) + if (!target_zone) { + ObjectLock olock2(endpoint); + endpoint->SetSyncing(false); return; + } for (;;) { boost::mutex::scoped_lock lock(m_LogLock); -- 2.40.0