From 81ea497ef6db491740c3aa8c66e2dc8189897f52 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Mon, 12 Mar 2018 15:37:22 +0100
Subject: [PATCH] Fix resetting the probation counter.

On an integer overflow while being in low-load state the probation
counter should not be reset to zero (indicating the load limit was
violated) but rather to the lowest value representing a valid load
(being _probation + 1).

Refers to #36
---
 ATxCommon/Monitoring/Cpu.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ATxCommon/Monitoring/Cpu.cs b/ATxCommon/Monitoring/Cpu.cs
index c30332f..62de16f 100644
--- a/ATxCommon/Monitoring/Cpu.cs
+++ b/ATxCommon/Monitoring/Cpu.cs
@@ -128,7 +128,7 @@ namespace ATxCommon.Monitoring
                         Log.Trace("CPU load behaving well since {0} cycles.", _behaving);
                     } else if (_behaving < 0) {
                         Log.Warn("Integer wrap around happened, resetting probation counter!");
-                        _behaving = 0;
+                        _behaving = _probation + 1;
                     }
                 }
             }
-- 
GitLab