Skip to content

Commit 5f055e3

Browse files
authored
fix: Align the cfg compilation with the socket2 (#160)
Closes hyperium/hyper#3817
1 parent dce81a0 commit 5f055e3

File tree

1 file changed

+68
-24
lines changed

1 file changed

+68
-24
lines changed

src/client/legacy/connect/http.rs

+68-24
Original file line numberDiff line numberDiff line change
@@ -111,45 +111,89 @@ impl TcpKeepaliveConfig {
111111
}
112112
}
113113

114-
#[cfg(not(any(
115-
target_os = "aix",
116-
target_os = "openbsd",
117-
target_os = "redox",
118-
target_os = "solaris"
119-
)))]
114+
#[cfg(
115+
// See https://docs.rs/socket2/0.5.8/src/socket2/lib.rs.html#511-525
116+
any(
117+
target_os = "android",
118+
target_os = "dragonfly",
119+
target_os = "freebsd",
120+
target_os = "fuchsia",
121+
target_os = "illumos",
122+
target_os = "ios",
123+
target_os = "visionos",
124+
target_os = "linux",
125+
target_os = "macos",
126+
target_os = "netbsd",
127+
target_os = "tvos",
128+
target_os = "watchos",
129+
target_os = "windows",
130+
)
131+
)]
120132
fn ka_with_interval(ka: TcpKeepalive, interval: Duration, dirty: &mut bool) -> TcpKeepalive {
121133
*dirty = true;
122134
ka.with_interval(interval)
123135
}
124136

125-
#[cfg(any(
126-
target_os = "aix",
127-
target_os = "openbsd",
128-
target_os = "redox",
129-
target_os = "solaris"
137+
#[cfg(not(
138+
// See https://docs.rs/socket2/0.5.8/src/socket2/lib.rs.html#511-525
139+
any(
140+
target_os = "android",
141+
target_os = "dragonfly",
142+
target_os = "freebsd",
143+
target_os = "fuchsia",
144+
target_os = "illumos",
145+
target_os = "ios",
146+
target_os = "visionos",
147+
target_os = "linux",
148+
target_os = "macos",
149+
target_os = "netbsd",
150+
target_os = "tvos",
151+
target_os = "watchos",
152+
target_os = "windows",
153+
)
130154
))]
131155
fn ka_with_interval(ka: TcpKeepalive, _: Duration, _: &mut bool) -> TcpKeepalive {
132156
ka // no-op as keepalive interval is not supported on this platform
133157
}
134158

135-
#[cfg(not(any(
136-
target_os = "aix",
137-
target_os = "openbsd",
138-
target_os = "redox",
139-
target_os = "solaris",
140-
target_os = "windows"
141-
)))]
159+
#[cfg(
160+
// See https://docs.rs/socket2/0.5.8/src/socket2/lib.rs.html#557-570
161+
any(
162+
target_os = "android",
163+
target_os = "dragonfly",
164+
target_os = "freebsd",
165+
target_os = "fuchsia",
166+
target_os = "illumos",
167+
target_os = "ios",
168+
target_os = "visionos",
169+
target_os = "linux",
170+
target_os = "macos",
171+
target_os = "netbsd",
172+
target_os = "tvos",
173+
target_os = "watchos",
174+
)
175+
)]
142176
fn ka_with_retries(ka: TcpKeepalive, retries: u32, dirty: &mut bool) -> TcpKeepalive {
143177
*dirty = true;
144178
ka.with_retries(retries)
145179
}
146180

147-
#[cfg(any(
148-
target_os = "aix",
149-
target_os = "openbsd",
150-
target_os = "redox",
151-
target_os = "solaris",
152-
target_os = "windows"
181+
#[cfg(not(
182+
// See https://docs.rs/socket2/0.5.8/src/socket2/lib.rs.html#557-570
183+
any(
184+
target_os = "android",
185+
target_os = "dragonfly",
186+
target_os = "freebsd",
187+
target_os = "fuchsia",
188+
target_os = "illumos",
189+
target_os = "ios",
190+
target_os = "visionos",
191+
target_os = "linux",
192+
target_os = "macos",
193+
target_os = "netbsd",
194+
target_os = "tvos",
195+
target_os = "watchos",
196+
)
153197
))]
154198
fn ka_with_retries(ka: TcpKeepalive, _: u32, _: &mut bool) -> TcpKeepalive {
155199
ka // no-op as keepalive retries is not supported on this platform

0 commit comments

Comments
 (0)