]> granicus.if.org Git - icinga2/commitdiff
Make sure the "syncing" attribute is set to false
authorGunnar Beutner <gunnar@beutner.name>
Mon, 8 Feb 2016 12:15:24 +0000 (13:15 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 23 Feb 2016 08:35:57 +0000 (09:35 +0100)
refs #11083

lib/icinga/checkable-check.cpp
lib/icinga/checkable.hpp
lib/remote/apilistener.cpp

index 762bc0c68f221a7e506ca556cb83feb833409d39..3c29a5b502c00e0b86cdab83944db10d3a1306c3 100644 (file)
@@ -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() + "'");
index 9ce25dbd1c745b91cfd20a56db0d702ff949a3ad..cef1147334ef7d2f9f38533877c3dc02c793696e 100644 (file)
@@ -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);
 
index 32c3499bd048589f0c82ad0be0ac7d8c869a72ff..6d4e5871f7cef52689c74068f32af9aab603df3a 100644 (file)
@@ -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);