Skip to content

Commit

Permalink
Merge pull request #190 from drnpkr/tcp-expiry-fix
Browse files Browse the repository at this point in the history
Fixed TCP flow expiration when a user plugin forcibly expires the flow on the first packet
  • Loading branch information
aouinizied committed May 10, 2024
2 parents 29e7e60 + 93986af commit e0cc925
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nfstream/meter.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ def consume(packet, cache, active_timeout, idle_timeout, channel, ffi, lib, udps
try:
cache[flow_key] = NFlow(packet, ffi, lib, udps, sync, accounting_mode, n_dissections,
statistics, splt, dissector, decode_tunnels, system_visibility_mode)
if cache[flow_key].expiration_id == -1: # A user Plugin forced expiration on the first packet
channel.put(
cache[flow_key].expire(udps, sync, n_dissections, statistics, splt, ffi, lib, dissector))
del cache[flow_key]
state = 0
except OSError:
print("WARNING: Failed to allocate memory space for flow creation. Flow creation aborted.")
state = 0
Expand Down

0 comments on commit e0cc925

Please sign in to comment.