Skip to content

Commit

Permalink
Assign ss_len if it exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
Berrysoft authored and Thomasdezeeuw committed Sep 11, 2023
1 parent 712e483 commit 16e85d5
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/sockaddr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,23 @@ impl From<SocketAddrV4> for SockAddr {
storage.sin_zero = Default::default();
mem::size_of::<sockaddr_in>() as socklen_t
};
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
target_os = "hermit",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "nto",
target_os = "openbsd",
target_os = "tvos",
target_os = "vxworks",
target_os = "watchos",
))]
{
storage.ss_len = len as u8;
}
SockAddr { storage, len }
}
}
Expand All @@ -311,6 +328,23 @@ impl From<SocketAddrV6> for SockAddr {
}
mem::size_of::<sockaddr_in6>() as socklen_t
};
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
target_os = "hermit",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "nto",
target_os = "openbsd",
target_os = "tvos",
target_os = "vxworks",
target_os = "watchos",
))]
{
storage.ss_len = len as u8;
}
SockAddr { storage, len }
}
}
Expand Down

0 comments on commit 16e85d5

Please sign in to comment.