From 77426aaf563f6e966c39deca18e97a652c9f3118 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 3 Sep 2020 10:19:05 +0800 Subject: [PATCH] kernel: hosted: ignore errors from shutting down network socket When running on Linux, attempting to shut down a network socket that has already been closed results in an error. That is, if the client disconnects, then the server will throw an error when it also attempts to disconnect. Ignore errors to `.shutdown()` to fix `cargo test` on Linux. Signed-off-by: Sean Cross --- kernel/src/arch/hosted.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/src/arch/hosted.rs b/kernel/src/arch/hosted.rs index c85e1b79a..2452eead2 100644 --- a/kernel/src/arch/hosted.rs +++ b/kernel/src/arch/hosted.rs @@ -293,8 +293,7 @@ fn listen_thread( should_exit.store(true, core::sync::atomic::Ordering::Relaxed); for (jh, conn) in clients { use std::net::Shutdown; - conn.shutdown(Shutdown::Both) - .expect("couldn't shutdown client"); + conn.shutdown(Shutdown::Both).ok(); jh.join().expect("couldn't join client thread"); } }