Skip to content

Commit

Permalink
Box up io_uring recv_msg
Browse files Browse the repository at this point in the history
  • Loading branch information
h33p committed Nov 3, 2023
1 parent 86c313e commit 6925205
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mfio-rt/src/native/impls/io_uring/tcp_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct StreamInner {
stream: StreamBuf,
in_read: bool,
in_write: usize,
recv_msg: msghdr,
recv_msg: Box<msghdr>,
read_queue: Vec<BoundPacketView<WrPerm>>,
write_queue: Vec<BoundPacketView<RdPerm>>,
}
Expand All @@ -64,7 +64,7 @@ impl From<net::TcpStream> for StreamInner {
stream: StreamBuf::default(),
in_read: false,
in_write: 0,
recv_msg: empty_msg(),
recv_msg: empty_msg().into(),
read_queue: Default::default(),
write_queue: Default::default(),
}
Expand Down Expand Up @@ -110,7 +110,7 @@ impl StreamInner {
let queue = self.stream.read_queue();
if !queue.is_empty() {
self.in_read = true;
let msg = &mut self.recv_msg;
let msg = &mut *self.recv_msg;
// Limit iov read to IOV_MAX, because we don't want to have the operation fail.
msg.msg_iovlen = core::cmp::min(queue.len() as usize, *IOV_MAX as usize) as _;

Check warning on line 115 in mfio-rt/src/native/impls/io_uring/tcp_stream.rs

View workflow job for this annotation

GitHub Actions / clippy

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> mfio-rt/src/native/impls/io_uring/tcp_stream.rs:115:71 | 115 | msg.msg_iovlen = core::cmp::min(queue.len() as usize, *IOV_MAX as usize) as _; | ^^^^^^^^^^^^^^^^^ help: try: `*IOV_MAX` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 115 in mfio-rt/src/native/impls/io_uring/tcp_stream.rs

View workflow job for this annotation

GitHub Actions / clippy

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> mfio-rt/src/native/impls/io_uring/tcp_stream.rs:115:49 | 115 | msg.msg_iovlen = core::cmp::min(queue.len() as usize, *IOV_MAX as usize) as _; | ^^^^^^^^^^^^^^^^^^^^ help: try: `queue.len()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast = note: `#[warn(clippy::unnecessary_cast)]` on by default

Check warning on line 115 in mfio-rt/src/native/impls/io_uring/tcp_stream.rs

View workflow job for this annotation

GitHub Actions / clippy

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> mfio-rt/src/native/impls/io_uring/tcp_stream.rs:115:71 | 115 | msg.msg_iovlen = core::cmp::min(queue.len() as usize, *IOV_MAX as usize) as _; | ^^^^^^^^^^^^^^^^^ help: try: `*IOV_MAX` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Check warning on line 115 in mfio-rt/src/native/impls/io_uring/tcp_stream.rs

View workflow job for this annotation

GitHub Actions / clippy

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> mfio-rt/src/native/impls/io_uring/tcp_stream.rs:115:49 | 115 | msg.msg_iovlen = core::cmp::min(queue.len() as usize, *IOV_MAX as usize) as _; | ^^^^^^^^^^^^^^^^^^^^ help: try: `queue.len()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast = note: `#[warn(clippy::unnecessary_cast)]` on by default
msg.msg_iov = queue.as_mut_ptr() as *mut iovec;
Expand Down

0 comments on commit 6925205

Please sign in to comment.