[proxy] Handle some unix signals.

On the surface, this doesn't add much, but there are some benefits:

* We can do graceful shutdowns and thus record more code coverage data.

* We now have a foundation for the more interesting behaviors, e.g. "stop
  accepting new connections after SIGTERM but keep serving the existing ones".

* We give the otel machinery a chance to flush trace events before
  finally shutting down.
This commit is contained in:
Dmitry Ivanov
2023-02-17 15:32:14 +03:00
parent 6f9af0aa8c
commit 956b6f17ca
9 changed files with 79 additions and 65 deletions
+1 -1
View File
@@ -186,8 +186,8 @@ async fn ws_handler(
}
pub async fn task_main(
ws_listener: TcpListener,
config: &'static ProxyConfig,
ws_listener: TcpListener,
) -> anyhow::Result<()> {
scopeguard::defer! {
info!("websocket server has shut down");