mirror of
https://github.com/smittix/intercept.git
synced 2026-06-12 07:53:30 -07:00
Fix grgsm_scanner stdout buffering and increase scan timeout
grgsm_scanner fully buffers stdout when piped, so scan results never reach Python until the buffer fills or process exits. Wrapping with stdbuf -oL forces line-buffered output for real-time data streaming. Also increased scan timeout from 120s to 300s since scanning 4 bands legitimately takes 2-3 minutes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+4
-2
@@ -373,7 +373,9 @@ def start_scanner():
|
|||||||
return jsonify({'error': 'grgsm_scanner not found. Please install gr-gsm.'}), 500
|
return jsonify({'error': 'grgsm_scanner not found. Please install gr-gsm.'}), 500
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd = ['grgsm_scanner']
|
# Use stdbuf to force line-buffered stdout - grgsm_scanner
|
||||||
|
# fully buffers stdout when piped, preventing real-time output
|
||||||
|
cmd = ['stdbuf', '-oL', 'grgsm_scanner']
|
||||||
|
|
||||||
# Add device argument (--args for RTL-SDR device selection)
|
# Add device argument (--args for RTL-SDR device selection)
|
||||||
cmd.extend(['--args', f'rtl={device_index}'])
|
cmd.extend(['--args', f'rtl={device_index}'])
|
||||||
@@ -1276,7 +1278,7 @@ def scanner_thread(cmd, device_index):
|
|||||||
# Process output with timeout
|
# Process output with timeout
|
||||||
scan_start = time.time()
|
scan_start = time.time()
|
||||||
last_output = scan_start
|
last_output = scan_start
|
||||||
scan_timeout = 120 # 2 minute maximum per scan
|
scan_timeout = 300 # 5 minute maximum per scan (4 bands takes ~2-3 min)
|
||||||
|
|
||||||
while app_module.gsm_spy_scanner_running:
|
while app_module.gsm_spy_scanner_running:
|
||||||
# Check if process died
|
# Check if process died
|
||||||
|
|||||||
Reference in New Issue
Block a user