From 0cdab7666fdd84eccb4f7c43269df4e0d55551c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= Date: Mon, 2 Oct 2023 16:45:56 +0200 Subject: [PATCH] cli: add error cause for TCP server's app_loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If there is an error when running as a TCP server (for instance a fatal formatting error on the stream), then the CLI will log the error, close the connection and continue listening for more TCP connections. This adds the cause of the error to the log, using Anyhow's Error alternate formatting. Signed-off-by: Daniel Estévez --- CHANGELOG.md | 1 + src/cli.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ee887c..ca0dc2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Do not fail if a packet cannot be written to the TUN. +- Add cause when logging errors for the TCP server. ## [0.4.1] - 2023-09-29 diff --git a/src/cli.rs b/src/cli.rs index ce14028..d61116d 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -200,7 +200,7 @@ pub fn main() -> Result<()> { } app.bbframe_recv = Some(BBFrameStream::new(stream)); if let Err(err) = app.app_loop() { - log::error!("error; waiting for another client: {err}"); + log::error!("error; waiting for another client: {err:#}"); } } }