From 51aaa23faa9573c3f7bc3a6d82df0212aa71d1c1 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 20 Jun 2012 15:33:38 +0200 Subject: [PATCH] Removed test code from the Service class. --- icinga/service.cpp | 13 ++++++++----- icinga/service.h | 5 +---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/icinga/service.cpp b/icinga/service.cpp index 3e29a7909..28c307ae1 100644 --- a/icinga/service.cpp +++ b/icinga/service.cpp @@ -69,15 +69,18 @@ long Service::GetRetryInterval(void) const void Service::SetNextCheck(time_t nextCheck) { - m_NextCheck = nextCheck; + GetConfigObject()->SetProperty("next_check", nextCheck); } time_t Service::GetNextCheck(void) { - if (m_NextCheck == -1) - m_NextCheck = time(NULL) + rand() % GetCheckInterval(); - - return m_NextCheck; + long value = -1; + GetConfigObject()->GetProperty("next_check", &value); + if (value == -1) { + value = time(NULL) + rand() % GetCheckInterval(); + SetNextCheck(value); + } + return value; } void Service::SetChecker(string checker) diff --git a/icinga/service.h b/icinga/service.h index ec063752a..e19db2fb1 100644 --- a/icinga/service.h +++ b/icinga/service.h @@ -8,7 +8,7 @@ class I2_ICINGA_API Service : public ConfigObjectAdapter { public: Service(const ConfigObject::Ptr& configObject) - : ConfigObjectAdapter(configObject), m_NextCheck(-1) + : ConfigObjectAdapter(configObject) { } string GetDisplayName(void) const; @@ -24,9 +24,6 @@ public: time_t GetNextCheck(void); void SetChecker(string checker); string GetChecker(void) const; - -private: - time_t m_NextCheck; }; } -- 2.40.0