Skip to content

Commit f3e0ac8

Browse files
committed
read until error or finished
1 parent fb3d256 commit f3e0ac8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tests/mpsc_sender.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ async fn mpsc_sender_clone_closed_error() -> TestResult<()> {
7272
async fn mpsc_sender_clone_drop_error() -> TestResult<()> {
7373
let (server, client, server_addr) = create_connected_endpoints()?;
7474
// accept a single bidi stream on a single connection, then read indefinitely
75-
// until we get an error
75+
// until we get an error or the stream is finished
7676
let server = tokio::spawn(async move {
7777
let conn = server.accept().await.unwrap().await?;
7878
let (_, mut recv) = conn.accept_bi().await?;
7979
let mut buf = vec![0u8; 1024];
80-
while recv.read(&mut buf).await.is_ok() {}
80+
while let Ok(Some(_)) = recv.read(&mut buf).await {}
8181
TestResult::Ok(())
8282
});
8383
let conn = client.connect(server_addr, "localhost")?.await?;
@@ -87,9 +87,6 @@ async fn mpsc_sender_clone_drop_error() -> TestResult<()> {
8787
let send3 = send1.clone();
8888
let second_client = tokio::spawn(async move {
8989
send2.closed().await;
90-
// why do I have to do this?
91-
// Shouldn't dropping the quinn:SendStream call finish, so the server would get an io error?
92-
conn.close(1u8.into(), b"");
9390
});
9491
let third_client = tokio::spawn(async move {
9592
// this should fail with an io error, since the stream was stopped

0 commit comments

Comments
 (0)