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:
@ -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
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user