@@ -279,11 +279,7 @@ void NHTFlowCache::create_record(const Packet& packet, size_t flow_index, size_t
279279 }
280280 m_flow_table[flow_index]->m_flow .flow_hash_ctt = packet.cttmeta .flow_hash ;
281281 if (only_metadata_required (m_flow_table[flow_index]->m_flow )) {
282- if (m_hashes_in_ctt.find (m_flow_table[flow_index]->m_flow .flow_hash_ctt ) != m_hashes_in_ctt.end ())
283- {
284- // throw "hash collision in create record!";
285- }
286- m_hashes_in_ctt.insert (m_flow_table[flow_index]->m_flow .flow_hash_ctt );
282+ m_hashes_in_ctt[m_flow_table[flow_index]->m_flow .flow_hash_ctt ]++;
287283 m_ctt_controller.create_record (m_flow_table[flow_index]->m_flow .flow_hash_ctt , m_flow_table[flow_index]->m_flow .time_first );
288284 m_flow_table[flow_index]->is_in_ctt = true ;
289285 }
@@ -297,11 +293,7 @@ void NHTFlowCache::try_to_add_flow_to_ctt(size_t flow_index) noexcept
297293 return ;
298294 }
299295 if (only_metadata_required (m_flow_table[flow_index]->m_flow )) {
300- if (m_hashes_in_ctt.find (m_flow_table[flow_index]->m_flow .flow_hash_ctt ) != m_hashes_in_ctt.end ())
301- {
302- // throw "hash collision in try_to_add_flow_to_ctt!";
303- }
304- m_hashes_in_ctt.insert (m_flow_table[flow_index]->m_flow .flow_hash_ctt );
296+ m_hashes_in_ctt[m_flow_table[flow_index]->m_flow .flow_hash_ctt ]++;
305297 m_ctt_controller.create_record (m_flow_table[flow_index]->m_flow .flow_hash_ctt , m_flow_table[flow_index]->m_flow .time_first );
306298 m_flow_table[flow_index]->is_in_ctt = true ;
307299 }
@@ -373,11 +365,13 @@ bool NHTFlowCache::try_to_export(size_t flow_index, bool call_pre_export, const
373365#ifdef WITH_CTT
374366void NHTFlowCache::send_export_request_to_ctt (size_t ctt_flow_hash) noexcept
375367{
376- if (m_hashes_in_ctt. find ( ctt_flow_hash) == m_hashes_in_ctt. end () )
368+ if (-- m_hashes_in_ctt[ ctt_flow_hash] < 0 )
377369 {
378370 throw " missing hash in send_export_request_to_ctt!" ;
379371 }
380- m_hashes_in_ctt.erase (ctt_flow_hash);
372+ if (m_hashes_in_ctt[ctt_flow_hash] == 0 ) {
373+ m_hashes_in_ctt.erase (ctt_flow_hash);
374+ }
381375 m_ctt_controller.export_record (ctt_flow_hash);
382376}
383377#endif /* WITH_CTT */
0 commit comments