This fixes unordered connections for one of the two cases (the second one might not be happening at all though).
What's happening:
Perf buffer event
for closed connection (index 2)
|
|
|
|
| Active: 1, 2, 3, 4, 5
collect from v
state.Connections Closed: 2 (more recent than
the ebpf map the active one)
+------------------------------+ +----------+
indices 1 2 3 4 5
+---------------------------------------------------------------->
Time
While we read the eBPF map to collect active connections (let’s say we have 5 entries to read)
We are at entry 3 when a closed connection pops from the perf buffer (let’s say it corresponds to entry 2 of the eBPF map), while we are still reading entries from the eBPF map we store it as a closed connection
Then we check both the 5 entries we collected and the closed connections (entry 2)
Entry 2 from closed connections has a more recent update time than the entry 2 from the eBPF map => we classify it as unordered
This fixes unordered connections for one of the two cases (the second one might not be happening at all though).
What's happening:
While we read the eBPF map to collect active connections (let’s say we have 5 entries to read) We are at entry 3 when a closed connection pops from the perf buffer (let’s say it corresponds to entry 2 of the eBPF map), while we are still reading entries from the eBPF map we store it as a closed connection
Then we check both the 5 entries we collected and the closed connections (entry 2) Entry 2 from closed connections has a more recent update time than the entry 2 from the eBPF map => we classify it as unordered