Method
init_inner
(
&self,
family: i32,
socket_kind: i32,
proto: i32,
sock: Socket,
)
Source from the content-addressed store, hash-verified
| 994 | } |
| 995 | |
| 996 | fn init_inner( |
| 997 | &self, |
| 998 | family: i32, |
| 999 | socket_kind: i32, |
| 1000 | proto: i32, |
| 1001 | sock: Socket, |
| 1002 | ) -> io::Result<()> { |
| 1003 | self.family.store(family); |
| 1004 | // Mask out SOCK_NONBLOCK and SOCK_CLOEXEC flags from stored type |
| 1005 | // to ensure consistent cross-platform behavior |
| 1006 | #[cfg(any( |
| 1007 | target_os = "android", |
| 1008 | target_os = "dragonfly", |
| 1009 | target_os = "freebsd", |
| 1010 | target_os = "fuchsia", |
| 1011 | target_os = "illumos", |
| 1012 | target_os = "linux", |
| 1013 | target_os = "netbsd", |
| 1014 | target_os = "openbsd", |
| 1015 | target_os = "redox" |
| 1016 | ))] |
| 1017 | let masked_kind = socket_kind & !(c::SOCK_NONBLOCK | c::SOCK_CLOEXEC); |
| 1018 | #[cfg(not(any( |
| 1019 | target_os = "android", |
| 1020 | target_os = "dragonfly", |
| 1021 | target_os = "freebsd", |
| 1022 | target_os = "fuchsia", |
| 1023 | target_os = "illumos", |
| 1024 | target_os = "linux", |
| 1025 | target_os = "netbsd", |
| 1026 | target_os = "openbsd", |
| 1027 | target_os = "redox" |
| 1028 | )))] |
| 1029 | let masked_kind = socket_kind; |
| 1030 | self.kind.store(masked_kind); |
| 1031 | self.proto.store(proto); |
| 1032 | let mut s = self.sock.write(); |
| 1033 | let sock = s.insert(sock); |
| 1034 | // If SOCK_NONBLOCK is set, use timeout 0 (non-blocking) |
| 1035 | #[cfg(any( |
| 1036 | target_os = "android", |
| 1037 | target_os = "dragonfly", |
| 1038 | target_os = "freebsd", |
| 1039 | target_os = "fuchsia", |
| 1040 | target_os = "illumos", |
| 1041 | target_os = "linux", |
| 1042 | target_os = "netbsd", |
| 1043 | target_os = "openbsd", |
| 1044 | target_os = "redox" |
| 1045 | ))] |
| 1046 | let timeout = if socket_kind & c::SOCK_NONBLOCK != 0 { |
| 1047 | 0.0 |
| 1048 | } else { |
| 1049 | DEFAULT_TIMEOUT.load() |
| 1050 | }; |
| 1051 | #[cfg(not(any( |
| 1052 | target_os = "android", |
| 1053 | target_os = "dragonfly", |
Tested by
no test coverage detected