fix(cmd): close packetChan after capture goroutine finishes

- Add close(packetChan) after captureEngine.Run() completes
- Ensures packet processor goroutine exits cleanly when channel is drained
- Prevents potential goroutine leak during shutdown

Fixes potential resource leak identified in architecture audit

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
Jacquin Antoine
2026-02-27 00:05:16 +01:00
parent 34a1aba64d
commit e4b8f5ab86

View File

@ -94,6 +94,7 @@ func main() {
"interface": appConfig.Core.Interface, "interface": appConfig.Core.Interface,
}) })
err := captureEngine.Run(appConfig.Core, packetChan) err := captureEngine.Run(appConfig.Core, packetChan)
close(packetChan) // Close channel to signal packet processor to shut down
captureErrChan <- err captureErrChan <- err
}() }()