Skip to content

Commit

Permalink
Fix pipe leaking when splite_n returns 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
yuguorui committed Apr 30, 2022
1 parent 5f19739 commit c482865
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ async fn _copy_bidirectional(inbound: &mut TcpStream, outbound: &mut TcpStream)
Ok::<(), std::io::Error>(())
};

let (_, _) = tokio::join!(client_to_server, server_to_client);
let _ = tokio::try_join!(client_to_server, server_to_client);

Ok(())
}
Expand Down Expand Up @@ -244,7 +244,7 @@ where
if ret > 0 {
n = ret;
} else {
break;
return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "zero_copy"));
}
}
Err(err) if err.kind() == io::ErrorKind::WouldBlock => {
Expand Down Expand Up @@ -278,7 +278,5 @@ where
}
}
}

Ok(())
}

0 comments on commit c482865

Please sign in to comment.