1
0
Fork 0
forked from wry/wry

io-uring: ensure that timeouts are encoded in the same submission

This commit is contained in:
Julian Orth 2022-05-13 22:31:56 +02:00
parent 7cc6c945d3
commit 4780315f50
5 changed files with 35 additions and 18 deletions

View file

@ -2,7 +2,7 @@ use {
crate::{
io_uring::{
pending_result::PendingResult,
sys::{io_uring_sqe, IORING_OP_SENDMSG, IOSQE_IO_LINK},
sys::{io_uring_sqe, IORING_OP_SENDMSG},
IoUring, IoUringData, IoUringError, Task,
},
time::Time,
@ -123,8 +123,9 @@ unsafe impl Task for SendmsgTask {
sqe.fd = self.fd;
sqe.u2.addr = &self.msghdr as *const _ as _;
sqe.u3.msg_flags = c::MSG_NOSIGNAL as _;
if self.has_timeout {
sqe.flags = IOSQE_IO_LINK;
}
}
fn has_timeout(&self) -> bool {
self.has_timeout
}
}

View file

@ -3,7 +3,7 @@ use {
io_uring::{
ops::TaskResult,
pending_result::PendingResult,
sys::{io_uring_sqe, IORING_OP_WRITE, IOSQE_IO_LINK},
sys::{io_uring_sqe, IORING_OP_WRITE},
IoUring, IoUringData, Task,
},
time::Time,
@ -74,8 +74,9 @@ unsafe impl Task for WriteTask {
sqe.u2.addr = data.buf.as_ptr() as _;
sqe.u3.rw_flags = 0;
sqe.len = data.buf.len() as _;
if self.has_timeout {
sqe.flags = IOSQE_IO_LINK;
}
}
fn has_timeout(&self) -> bool {
self.has_timeout
}
}