From dff150419b7034f076bd13cb6888bb52847e1917 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 20 Sep 2018 17:20:58 +0200 Subject: [PATCH] Prevent statistics going negative when going through server restarts --- src/controller/controller_statistics.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controller/controller_statistics.cpp b/src/controller/controller_statistics.cpp index d562c99c..713dbef0 100644 --- a/src/controller/controller_statistics.cpp +++ b/src/controller/controller_statistics.cpp @@ -315,13 +315,13 @@ void Controller::statSession::ping(const Controller::sessIndex & index, unsigned if (lastSec < disconnectPoint){ switch (sessionType){ case SESS_INPUT: - streamStats[index.streamName].currIns--; + if (streamStats[index.streamName].currIns){streamStats[index.streamName].currIns--;} break; case SESS_OUTPUT: - streamStats[index.streamName].currOuts--; + if (streamStats[index.streamName].currOuts){streamStats[index.streamName].currOuts--;} break; case SESS_VIEWER: - streamStats[index.streamName].currViews--; + if (streamStats[index.streamName].currViews){streamStats[index.streamName].currViews--;} break; } uint64_t duration = lastSec - firstSec;