Pass Clippy and ignore shutdown error

The client might close the connection before the server noticed. So we simply ignore the error thrown by the shutdown operation.
This commit is contained in:
KernelErr
2021-10-21 17:01:52 +08:00
parent 2c2509a178
commit 4352050b04
2 changed files with 31 additions and 40 deletions

View File

@@ -41,7 +41,7 @@ impl Server {
let default = proxy.default.clone().unwrap_or_else(|| "ban".to_string());
let upstream = config.upstream.clone();
let mut upstream_set: HashSet<String> = HashSet::new();
for (key, _) in &upstream {
for key in upstream.keys() {
if key.eq("ban") || key.eq("echo") {
continue;
}
@@ -200,7 +200,7 @@ where
{
match io::copy(reader, writer).await {
Ok(u64) => {
writer.shutdown().await?;
let _ = writer.shutdown().await;
Ok(u64)
}
Err(_) => Ok(0),