Skip to content

Commit 07106a7

Browse files
committed
Fix rust-fmt + add comment.
1 parent 3bc451b commit 07106a7

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/io/sendmsg_zc.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//use crate::buf::BoundedBuf;
21
use crate::io::SharedFd;
32
use crate::runtime::driver::op::{Completable, CqeResult, MultiCQEFuture, Op, Updateable};
43
use crate::runtime::CONTEXT;
@@ -22,27 +21,31 @@ impl Op<SendMsgZc, MultiCQEFuture> {
2221
x.handle().expect("Not in a runtime context").submit_op(
2322
SendMsgZc {
2423
fd: fd.clone(),
25-
msghdr: msghdr.clone(),
24+
msghdr: msghdr.copy(),
2625
bytes: 0,
2726
},
2827
|sendmsg_zc| {
29-
opcode::SendMsgZc::new(types::Fd(sendmsg_zc.fd.raw_fd()), &sendmsg_zc.msghdr as *const _).build()
28+
opcode::SendMsgZc::new(
29+
types::Fd(sendmsg_zc.fd.raw_fd()),
30+
&sendmsg_zc.msghdr as *const _
31+
)
32+
.build()
3033
},
3134
)
3235
})
3336
}
3437
}
3538

3639
impl Completable for SendMsgZc {
37-
type Output = (libc::msghdr, io::Result<usize>) ;
40+
type Output = (libc::msghdr, io::Result<usize>);
3841

3942
fn complete(self, cqe: CqeResult) -> (libc::msghdr, io::Result<usize>) {
4043
// Convert the operation result to `usize`
4144
let res = cqe.result.map(|v| v as usize);
4245

4346
// Recover the msghdr.
4447
let msghdr = self.msghdr;
45-
48+
4649
(msghdr, res)
4750
}
4851
}

src/io/socket.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ impl Socket {
147147
op.await
148148
}
149149

150-
pub(crate) async fn sendmsg_zc(&self, msghdr: &libc::msghdr) -> (libc::msghdr, io::Result<usize>) {
150+
pub(crate) async fn sendmsg_zc(
151+
&self,
152+
msghdr: &libc::msghdr
153+
) -> (libc::msghdr, io::Result<usize>) {
151154
let op = Op::sendmsg_zc(&self.fd, msghdr).unwrap();
152155
op.await
153156
}

src/net/udp.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ impl UdpSocket {
220220
self.inner.send_zc(buf).await
221221
}
222222

223-
pub async fn sendmsg_zc(&self, msghdr: &libc::msghdr) -> (libc::msghdr, io::Result<usize>) {
223+
/// Sends a message on the socket using a msghdr.
224+
pub async fn sendmsg_zc(&self, msghdr: &libc::msghdr) -> (libc::msghdr, io::Result<usize>) {
224225
self.inner.sendmsg_zc(msghdr).await
225226
}
226227

0 commit comments

Comments
 (0)