Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions nvx-rs/src/guest/sys/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ use super::{Errno, FileDescriptor};
/// Connecting fixes the destination of every `write` and the only source from which `read`
/// receives, as the `socket` and `connect` calls of `nvx-device-io`'s C program did.
pub(crate) fn connect_datagram(peer: SocketAddrV4) -> Result<FileDescriptor, Errno> {
let socket = nix::sys::socket::socket(
AddressFamily::Inet,
SockType::Datagram,
SockFlag::SOCK_CLOEXEC,
None,
)?;
let UdpSocket(socket) = UdpSocket::ipv4()?;
nix::sys::socket::connect(socket.as_raw_fd(), &SockaddrIn::from(peer))?;
Ok(FileDescriptor::from_owned(socket))
}
Expand Down
Loading