stop sniffer
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 10s
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 10s
This commit is contained in:
@@ -55,6 +55,30 @@ class PacketTracker:
|
||||
self._stop_event.set()
|
||||
self._thread.join(timeout=settings.packet_tracker_stop_join_timeout_seconds)
|
||||
|
||||
def discard_entries_for_ifaces(self, ifaces: List[str]) -> int:
|
||||
"""Drop in-memory entries that belong to interfaces no longer being sniffed."""
|
||||
targets = {iface for iface in ifaces if iface}
|
||||
if not targets:
|
||||
return 0
|
||||
|
||||
removed = 0
|
||||
with self._lock:
|
||||
for correlation_key in list(self._entries.keys()):
|
||||
payload = self._entries[correlation_key]["payload"]
|
||||
related_ifaces = {
|
||||
payload.get("ingress_if"),
|
||||
payload.get("egress_if"),
|
||||
payload.get("capture_iface"),
|
||||
}
|
||||
telemetry_metadata = payload.get("telemetry_metadata") or {}
|
||||
if isinstance(telemetry_metadata, dict):
|
||||
related_ifaces.add(telemetry_metadata.get("iface"))
|
||||
|
||||
if related_ifaces & targets:
|
||||
self._entries.pop(correlation_key, None)
|
||||
removed += 1
|
||||
return removed
|
||||
|
||||
def observe_packet(self, pkt_info: Dict[str, Any]) -> str:
|
||||
"""Merge parsed packet information into a pending packet entry."""
|
||||
now_ts = time.time()
|
||||
|
||||
Reference in New Issue
Block a user