Skip to content

Commit e66de36

Browse files
committed
Fix AsyncFd::listen
Forgotten to commit this in the previous commit. Fixes: 907141c
1 parent 8eadc46 commit e66de36

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/io_uring/net.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub(crate) struct ListenOp;
8080
impl FdOp for ListenOp {
8181
type Output = ();
8282
type Resources = ();
83-
type Args = libc::c_int; // backlog.
83+
type Args = u32; // backlog.
8484

8585
#[allow(clippy::cast_sign_loss)]
8686
fn fill_submission(
@@ -91,7 +91,7 @@ impl FdOp for ListenOp {
9191
) {
9292
submission.0.opcode = libc::IORING_OP_LISTEN as u8;
9393
submission.0.fd = fd.fd();
94-
submission.0.len = *backlog as u32;
94+
submission.0.len = *backlog;
9595
}
9696

9797
fn map_ok(_: &AsyncFd, (): Self::Resources, (_, n): OpReturn) -> Self::Output {

src/kqueue/net.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ pub(crate) struct ListenOp;
9595
impl DirectFdOp for ListenOp {
9696
type Output = ();
9797
type Resources = ();
98-
type Args = libc::c_int; // backlog.
98+
type Args = u32; // backlog.
9999

100100
fn run(fd: &AsyncFd, (): Self::Resources, backlog: Self::Args) -> io::Result<Self::Output> {
101-
syscall!(listen(fd.fd(), backlog))?;
101+
syscall!(listen(fd.fd(), backlog.cast_signed()))?;
102102
Ok(())
103103
}
104104
}

tests/util/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ pub(crate) async fn bind_and_listen_ipv4(socket: &AsyncFd) -> SocketAddr {
474474
Err(ref err) if is_unsupported(err) => {
475475
// IORING_OP_LISTEN is only available since 6.11, fall back to a
476476
// blocking system call.
477-
syscall!(listen(fd, backlog)).map(|_| ())
477+
syscall!(listen(fd, backlog.cast_signed())).map(|_| ())
478478
}
479479
Err(err) => Err(err),
480480
}

0 commit comments

Comments
 (0)