Fix: Check attempt counter is invalid.

Fixes #5734
This commit is contained in:
Gunnar Beutner 2014-03-10 08:56:31 +01:00
parent 332a21a7d0
commit bd37b9b62f
1 changed files with 1 additions and 3 deletions

View File

@ -262,7 +262,7 @@ void Service::ProcessCheckResult(const CheckResult::Ptr& cr, const String& autho
SetLastStateType(old_stateType); SetLastStateType(old_stateType);
SetLastReachable(reachable); SetLastReachable(reachable);
long attempt; long attempt = 1;
if (!old_cr) { if (!old_cr) {
SetStateType(StateTypeHard); SetStateType(StateTypeHard);
@ -270,14 +270,12 @@ void Service::ProcessCheckResult(const CheckResult::Ptr& cr, const String& autho
if (old_state == StateOK && old_stateType == StateTypeSoft) if (old_state == StateOK && old_stateType == StateTypeSoft)
SetStateType(StateTypeHard); // SOFT OK -> HARD OK SetStateType(StateTypeHard); // SOFT OK -> HARD OK
attempt = 1;
recovery = true; recovery = true;
ResetNotificationNumbers(); ResetNotificationNumbers();
SetLastStateOK(Utility::GetTime()); SetLastStateOK(Utility::GetTime());
} else { } else {
if (old_attempt >= GetMaxCheckAttempts()) { if (old_attempt >= GetMaxCheckAttempts()) {
SetStateType(StateTypeHard); SetStateType(StateTypeHard);
attempt = 1;
} else if (GetStateType() == StateTypeSoft || GetState() == StateOK) { } else if (GetStateType() == StateTypeSoft || GetState() == StateOK) {
SetStateType(StateTypeSoft); SetStateType(StateTypeSoft);
attempt = old_attempt + 1; attempt = old_attempt + 1;