Skip to content

Commit

Permalink
try pass compile in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
loongs-zhang committed Feb 7, 2024
1 parent 576b695 commit 9c42c32
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions monoio/src/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ impl UdpSocket {
}

/// Creates new `UdpSocket` from a `std::net::UdpSocket`.
#[cfg(unix)]
pub fn from_std(socket: std::net::UdpSocket) -> io::Result<Self> {
match SharedFd::new::<false>(socket.as_raw_fd()) {
Ok(shared) => {
Expand All @@ -158,6 +159,17 @@ impl UdpSocket {
}
}

#[cfg(windows)]
pub fn from_std(socket: std::net::UdpSocket) -> io::Result<Self> {
match SharedFd::new(socket.as_raw_socket()) {
Ok(shared) => {
socket.into_raw_socket();
Ok(Self::from_shared_fd(shared))
}
Err(e) => Err(e),
}
}

/// Set value for the `SO_REUSEADDR` option on this socket.
pub fn set_reuse_address(&self, reuse: bool) -> io::Result<()> {
#[cfg(unix)]
Expand Down

0 comments on commit 9c42c32

Please sign in to comment.