From: Ian Jackson Date: Sun, 8 Aug 2021 00:11:14 +0000 (+0100) Subject: ipif: Use OptionPrefixColon for quitting X-Git-Tag: hippotat/1.0.0~243 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=97b4b309239e74ced56924555079993fb8f2957f;p=hippotat.git ipif: Use OptionPrefixColon for quitting Signed-off-by: Ian Jackson --- diff --git a/src/bin/client.rs b/src/bin/client.rs index 2f2e676..4528733 100644 --- a/src/bin/client.rs +++ b/src/bin/client.rs @@ -292,7 +292,7 @@ async fn run_client( } }.await; - ipif.quitting(&ic).await; + ipif.quitting(Some(&ic)).await; trouble } diff --git a/src/ipif.rs b/src/ipif.rs index 14f9d6d..dbffb3a 100644 --- a/src/ipif.rs +++ b/src/ipif.rs @@ -46,22 +46,23 @@ impl Ipif { } } - pub async fn quitting(mut self, ic: &InstanceConfig) { + pub async fn quitting(mut self, ic: Option<&InstanceConfig>) { + let icd = OptionPrefixColon(ic); drop(self.tx); match self.child.wait().await { - Err(e) => error!("{}: also, failed to await ipif child: {}", &ic, e), + Err(e) => error!("{}also, failed to await ipif child: {}", icd, e), Ok(st) => { let stderr_timeout = Duration::from_millis(1000); match tokio::time::timeout(stderr_timeout, self.stderr_task).await { Err::<_,tokio::time::error::Elapsed>(_) - => warn!("{}: ipif stderr task continues!", &ic), - Ok(Err(e)) => error!("{}: ipif stderr task crashed: {}", &ic, e), - Ok(Ok(Err(e))) => error!("{}: ipif stderr read failed: {}", &ic, e), + => warn!("{}ipif stderr task continues!", icd), + Ok(Err(e)) => error!("{}ipif stderr task crashed: {}", icd, e), + Ok(Ok(Err(e))) => error!("{}ipif stderr read failed: {}", icd, e), Ok(Ok(Ok(()))) => { }, } if ! st.success() { - error!("{}: ipif process failed: {}", &ic, st); + error!("{}ipif process failed: {}", icd, st); } } }