Skip to content

Commit cec9d71

Browse files
committed
++ cavhe
1 parent 28d7bdc commit cec9d71

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

storage/cache.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,8 @@ int NHTFlowCache::put_pkt(Packet& packet)
527527
auto [row, flow_id] = find_flow_index(direct_key, reversed_key, packet.vlan_id);
528528

529529
if (std::holds_alternative<size_t>(flow_id)) {
530-
const size_t empty_place = get_empty_place(row, packet.ts);
530+
const size_t hash_value = std::get<size_t>(flow_id);
531+
const size_t empty_place = get_empty_place(row, packet.ts) + hash_value & m_line_mask;
531532
create_record(packet, empty_place, std::get<size_t>(flow_id));
532533
export_expired(packet.ts);
533534
return 0;
@@ -581,7 +582,7 @@ size_t NHTFlowCache::get_empty_place(CacheRowSpan& row, const timeval& now) noex
581582
#endif /* WITH_CTT */
582583
plugins_pre_export(row[m_new_flow_insert_index]->m_flow);
583584
export_flow(&row[m_new_flow_insert_index] - m_flow_table.data(), FLOW_END_NO_RES);
584-
return &row[m_new_flow_insert_index] + m_new_flow_insert_index - m_flow_table.data();
585+
return m_new_flow_insert_index;
585586
}
586587

587588
bool NHTFlowCache::try_to_export_on_active_timeout(size_t flow_index, const timeval& now) noexcept

0 commit comments

Comments
 (0)