A panic occurs when calling recv_from() on a UdpSocket after the socket has been shut down using shutdown(). The error message indicates that an Option::unwrap() is called on a None value within the recv_from method of the tokio-uring library.
Steps to Reproduce
Compile and run the following Rust code using Tokio-Uring:
use std::net::{Shutdown, SocketAddr};
use tokio_uring::net::UdpSocket;
fn main() -> Result<(), std::io::Error> {
tokio_uring::start(async {
let local_addr: SocketAddr = "0.0.0.0:0".parse().unwrap();
let socket = UdpSocket::bind(local_addr).await?;
let buf = vec![0; 8196];
let _ = socket.shutdown(Shutdown::Both);
let _ = socket.recv_from(buf).await;
Ok(())
})
}
Run the program with cargo run.
Expected Behavior
The program should handle the shutdown state gracefully, either by returning a specific error or by not panicking.
Observed Behavior
The program panics with the following message:
thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-uring-0.5.0/src/io/recv_from.rs:71:55: called `Option::unwrap()` on a `None` value
Environment
Description
A panic occurs when calling
recv_from()
on aUdpSocket
after the socket has been shut down usingshutdown()
. The error message indicates that anOption::unwrap()
is called on aNone
value within therecv_from
method of the tokio-uring library.Steps to Reproduce
Compile and run the following Rust code using Tokio-Uring:
Run the program with
cargo run
.Expected Behavior
The program should handle the shutdown state gracefully, either by returning a specific error or by not panicking.
Observed Behavior
The program panics with the following message: