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))