cloudflare / cloudflare/boringtun
Can't intercept SIGINT, SIGTERM when using boringtun
- Dominant language
- Rust
- Stars
- 7.2k
- Forks
- 532
- PR merge metrics
- No merged PRs in 30d
Description
Boringtun intercepts SIGINT and SIGTERM on register_api_signal_handlers(), at device/api.rs (line 144).
Therefore, any application that wants to handle these signals will be unable to do so.
Just as boringtun needs to do some cleanup on that case, an application might have some of it's cleaning to do or being able to decide to keep on running or not depending on the different reasons boringtun has stopped (e.g: distinguish network error from ctrl-c).
I suggest 2 different approaches to solving this:
1) Through dependency injection: the api could allow to add a callback / lambda to be called if the user presses ctrl-c or another cause for boringtun exit happens
2) Through a return value: currently DeviceHandler::wait() doesn't return any value. It could return a value describing the reason it stopped.
Contributor guide
Assessment
This issue has not been assessed yet.