tabbed frametype filtering
This commit is contained in:
@@ -37,7 +37,7 @@ class BackgroundAnalyzer:
|
||||
"""Analyzer that processes PCAP files in background threads"""
|
||||
|
||||
def __init__(self, analyzer: EthernetAnalyzer,
|
||||
num_threads: int = 4,
|
||||
num_threads: int = 1, # Force single-threaded to avoid race conditions
|
||||
batch_size: int = 1000,
|
||||
progress_callback: Optional[Callable[[ParsingProgress], None]] = None,
|
||||
flow_update_callback: Optional[Callable[[], None]] = None):
|
||||
@@ -74,7 +74,7 @@ class BackgroundAnalyzer:
|
||||
|
||||
# Flow update batching
|
||||
self.packets_since_update = 0
|
||||
self.update_batch_size = 50 # Update UI every 50 packets (more frequent)
|
||||
self.update_batch_size = 100 # Update UI every 100 packets (slower for less frequent updates)
|
||||
self.update_lock = threading.Lock()
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
@@ -87,6 +87,7 @@ class BackgroundAnalyzer:
|
||||
return
|
||||
|
||||
self.is_parsing = True
|
||||
self.analyzer.is_parsing = True # Set parsing flag on analyzer
|
||||
self.stop_event.clear()
|
||||
self.start_time = time.time()
|
||||
self.processed_packets = 0
|
||||
@@ -221,8 +222,8 @@ class BackgroundAnalyzer:
|
||||
try:
|
||||
current_time = time.time()
|
||||
|
||||
# Update every 0.5 seconds
|
||||
if current_time - last_update_time >= 0.5:
|
||||
# Update every 2.0 seconds (slower progress updates)
|
||||
if current_time - last_update_time >= 2.0:
|
||||
with self.parse_lock:
|
||||
current_packets = self.processed_packets
|
||||
|
||||
@@ -246,7 +247,7 @@ class BackgroundAnalyzer:
|
||||
if all(f.done() for f in futures):
|
||||
break
|
||||
|
||||
time.sleep(0.1)
|
||||
time.sleep(0.5) # Slower monitoring loop
|
||||
except KeyboardInterrupt:
|
||||
self.logger.info("Monitor thread interrupted")
|
||||
break
|
||||
@@ -256,6 +257,7 @@ class BackgroundAnalyzer:
|
||||
|
||||
# Final update
|
||||
self.is_parsing = False
|
||||
self.analyzer.is_parsing = False # Clear parsing flag on analyzer
|
||||
self._report_progress(is_complete=True)
|
||||
|
||||
# Final flow update
|
||||
@@ -267,7 +269,7 @@ class BackgroundAnalyzer:
|
||||
|
||||
# Calculate final statistics
|
||||
with self.flow_lock:
|
||||
self.analyzer.statistics_engine.calculate_all_statistics()
|
||||
self.analyzer.statistics_engine.calculate_flow_statistics(self.analyzer.flows)
|
||||
|
||||
def _report_progress(self, packets_per_second: float = 0,
|
||||
elapsed_time: float = 0,
|
||||
|
||||
Reference in New Issue
Block a user