From: Maxim Mamontov Date: Mon, 6 Dec 2010 16:02:26 +0000 (+0200) Subject: Исправлена проблема копирования итераторов при выполнении swap на X-Git-Tag: 2.407-rc3~341 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/03b3169e54fbe4d4cae99307810b1f52f85c8f5a?ds=sidebyside Исправлена проблема копирования итераторов при выполнении swap на индексе пакетов по IP-адресам --- diff --git a/projects/stargazer/traffcounter.cpp b/projects/stargazer/traffcounter.cpp index 54014167..e834b81f 100644 --- a/projects/stargazer/traffcounter.cpp +++ b/projects/stargazer/traffcounter.cpp @@ -287,7 +287,7 @@ int oldIp2packetsSize = ip2packets.size(); pp_iter pi; pi = packets.begin(); std::map newPackets; -std::multimap newIP2Packets; +ip2packets.erase(ip2packets.begin(), ip2packets.end()); while (pi != packets.end()) { //Flushing @@ -388,14 +388,13 @@ while (pi != packets.end()) pair res = newPackets.insert(*pi); if (res.second) { - newIP2Packets.insert(make_pair(pi->first.GetSrcIP(), res.first)); - newIP2Packets.insert(make_pair(pi->first.GetDstIP(), res.first)); + ip2packets.insert(make_pair(pi->first.GetSrcIP(), res.first)); + ip2packets.insert(make_pair(pi->first.GetDstIP(), res.first)); } } ++pi; } swap(packets, newPackets); -swap(ip2packets, newIP2Packets); printfd(__FILE__, "FlushAndRemove() packets: %d(rem %d) ip2packets: %d(rem %d)\n", packets.size(), oldPacketsSize - packets.size(),