#How does tokio-rs/tokio-uring notify if a submitted operation carries a certain result?

2 messages · Page 1 of 1 (latest)

raven bronze
#

How does tokio-rs/tokio-uring detect the failure by tokio-rs/io-uring, in the following example:

let (result, nbuf) = stream.read(buf).await;
buf = nbuf;
let read = result.unwrap();
if read == 0 {
    println!("{} closed, {} total ping-ponged", socket_addr, n);
    break;
}

What does it do to avoid waiting infinitely, or even notifying that the operation failed, shouldn't it return an enum Result ?

In io_uring, every submitted operation – such as prep_recv – is completed with a CQE (Completion Queue Event) that carries a result code. This code may indicate that the operation was successful (non-negative value).

That said, shouldn't the library at least return success or failure information to the user?

normal light
#

shouldn't it return an enum Result ?

Do you mean the one you're .unwrap()ing on line 3?