Skip to content

Commit 51c717e

Browse files
committed
++ cache
1 parent c100a5d commit 51c717e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

storage/cache.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -524,20 +524,21 @@ int NHTFlowCache::put_pkt(Packet& packet)
524524
const std::variant<FlowKeyv4, FlowKeyv6> reversed_key = *FlowKeyFactory::create_reversed_key(&packet.src_ip, &packet.dst_ip,
525525
packet.src_port, packet.dst_port, packet.ip_proto, static_cast<IP>(packet.ip_version));
526526

527-
auto [row, flow_id] = find_flow_index(direct_key, reversed_key, packet.vlan_id);
527+
auto [row, flow_identification] = find_flow_index(direct_key, reversed_key, packet.vlan_id);
528528

529-
if (std::holds_alternative<size_t>(flow_id)) {
530-
const size_t hash_value = std::get<size_t>(flow_id);
529+
if (std::holds_alternative<size_t>(flow_identification)) {
530+
const size_t hash_value = std::get<size_t>(flow_identification);
531531
const size_t empty_place = get_empty_place(row, packet.ts) + (hash_value & m_line_mask);
532532
create_record(packet, empty_place, hash_value);
533533
export_expired(packet.ts);
534534
return 0;
535535
}
536-
const size_t index = flow_id.index();
537-
if (!std::holds_alternative<std::pair<size_t, bool>>(flow_id)) {
536+
const size_t index = flow_identification.index();
537+
if (!std::holds_alternative<std::pair<size_t, bool>>(flow_identification)) {
538538
std::cout << std::endl;
539539
}
540-
const auto [flow_index, source_to_destination] = std::get<std::pair<size_t, bool>>(flow_id);
540+
const auto [flow_index, source_to_destination] = std::get<std::pair<size_t, bool>>(flow_identification);
541+
const size_t hash_value = m_flow_table[flow_index]->m_flow.flow_hash;
541542
#ifdef WITH_CTT
542543
const bool flow_is_waiting_for_export = !try_to_export_delayed_flow(packet, flow_index) && m_flow_table[flow_index]->is_waiting_for_export;
543544
#else
@@ -546,7 +547,7 @@ int NHTFlowCache::put_pkt(Packet& packet)
546547

547548
#ifdef WITH_CTT
548549
if (m_flow_table[flow_index]->is_empty()) {
549-
create_record(packet, flow_index, std::get<size_t>(flow_id));
550+
create_record(packet, flow_index, hash_value);
550551
export_expired(packet.ts);
551552
return 0;
552553
}

0 commit comments

Comments
 (0)