From dbf7267f79883fc50db9a0c5cf54b9f6d6cffbee Mon Sep 17 00:00:00 2001 From: acetone Date: Fri, 25 Nov 2022 15:20:41 +0300 Subject: [PATCH] last dests list forming edited --- src/statistics.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/statistics.cpp b/src/statistics.cpp index 018e75f..6fef0d6 100644 --- a/src/statistics.cpp +++ b/src/statistics.cpp @@ -51,14 +51,19 @@ void Statistics::report(const LogEvent& event) } m_lastDestinationsMtx.lock(); - if (not m_lastDestinations.contains(event.dest)) + int index = m_lastDestinations.indexOf(event.dest); + if (index == -1) { if (m_lastDestinations.size() == 5) { m_lastDestinations.pop_back(); } - m_lastDestinations.push_front(event.dest); } + else + { + m_lastDestinations.removeAt(index); + } + m_lastDestinations.push_front(event.dest); m_lastDestinationsMtx.unlock(); if (g::p::IGNORE_IP_ADDRS_IN_STATISTCS and isIpAddress(event.dest))