Skip to content

Commit

Permalink
Clippy/build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrittenhouse committed Apr 25, 2024
1 parent c6bce4d commit 60df557
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dgram/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ pub fn send_to(
tx_time: Option<Instant>, client_addr: &SocketAddr,
) -> Result<usize> {
loop {
// Important to use try_io so events keep coming even if we see
// EAGAIN/EWOULDBLOCK
let res = socket.try_io(|| {
// mio::net::UdpSocket doesn't implement AsFd (yet?).
let fd = unsafe {
std::os::fd::BorrowedFd::borrow_raw(socket.as_raw_fd())
};

let sent = send_msg(
&fd,
fd,
send_buf,
gso_settings,
tx_time,
Expand All @@ -46,14 +48,16 @@ pub async fn recv_from(
msg_flags: Option<MsgFlags>,
) -> Result<RecvData> {
loop {
// Important to use try_io so events keep coming even if we see
// EAGAIN/EWOULDBLOCK
let res = socket.try_io(|| {
// mio::net::UdpSocket doesn't implement AsFd (yet?).
let fd = unsafe {
std::os::fd::BorrowedFd::borrow_raw(socket.as_raw_fd())
};

let recvd = recv_msg(
&fd,
fd,
read_buf,
cmsg_space,
msg_flags.unwrap_or(MsgFlags::empty()),
Expand Down

0 comments on commit 60df557

Please sign in to comment.