test better shutdown nfstream
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 9s
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 9s
This commit is contained in:
@@ -185,6 +185,8 @@ class NFStreamManager:
|
||||
str(settings.nfstream_snapshot_length),
|
||||
"--n-dissections",
|
||||
str(settings.nfstream_n_dissections),
|
||||
"--n-meters",
|
||||
str(settings.nfstream_n_meters),
|
||||
]
|
||||
if settings.nfstream_promiscuous_mode:
|
||||
cmd.append("--promiscuous-mode")
|
||||
@@ -198,6 +200,7 @@ class NFStreamManager:
|
||||
text=True,
|
||||
bufsize=1,
|
||||
env=env,
|
||||
start_new_session=True,
|
||||
)
|
||||
except Exception:
|
||||
logger.exception("Failed to start NFStream worker for %s", iface)
|
||||
@@ -226,10 +229,13 @@ class NFStreamManager:
|
||||
|
||||
if process is not None and process.poll() is None:
|
||||
try:
|
||||
process.send_signal(signal.SIGTERM)
|
||||
os.killpg(os.getpgid(process.pid), signal.SIGTERM)
|
||||
process.wait(timeout=settings.nfstream_process_stop_timeout_seconds)
|
||||
except subprocess.TimeoutExpired:
|
||||
process.kill()
|
||||
try:
|
||||
os.killpg(os.getpgid(process.pid), signal.SIGKILL)
|
||||
except ProcessLookupError:
|
||||
pass
|
||||
except Exception:
|
||||
logger.exception("Failed to stop NFStream worker for %s cleanly", iface)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user