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 <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-09-03 10:19:05 +08:00
parent 019d520b26
commit 77426aaf56

View file

@ -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");
}
}