File tree Expand file tree Collapse file tree 1 file changed +45
-38
lines changed
src/client/legacy/connect Expand file tree Collapse file tree 1 file changed +45
-38
lines changed Original file line number Diff line number Diff line change @@ -111,48 +111,55 @@ impl TcpKeepaliveConfig {
111
111
}
112
112
}
113
113
114
- #[ cfg( not( any(
115
- target_os = "aix" ,
116
- target_os = "openbsd" ,
117
- target_os = "redox" ,
118
- target_os = "solaris"
119
- ) ) ) ]
120
114
fn ka_with_interval ( ka : TcpKeepalive , interval : Duration , dirty : & mut bool ) -> TcpKeepalive {
121
- * dirty = true ;
122
- ka. with_interval ( interval)
123
- }
124
-
125
- #[ cfg( any(
126
- target_os = "aix" ,
127
- target_os = "openbsd" ,
128
- target_os = "redox" ,
129
- target_os = "solaris"
130
- ) ) ]
131
- fn ka_with_interval ( ka : TcpKeepalive , _: Duration , _: & mut bool ) -> TcpKeepalive {
132
- ka // no-op as keepalive interval is not supported on this platform
115
+ if cfg ! (
116
+ // See https://docs.rs/socket2/0.5.8/src/socket2/lib.rs.html#511-525
117
+ any(
118
+ target_os = "android" ,
119
+ target_os = "dragonfly" ,
120
+ target_os = "freebsd" ,
121
+ target_os = "fuchsia" ,
122
+ target_os = "illumos" ,
123
+ target_os = "ios" ,
124
+ target_os = "visionos" ,
125
+ target_os = "linux" ,
126
+ target_os = "macos" ,
127
+ target_os = "netbsd" ,
128
+ target_os = "tvos" ,
129
+ target_os = "watchos" ,
130
+ target_os = "windows" ,
131
+ )
132
+ ) {
133
+ * dirty = true ;
134
+ ka. with_interval ( interval)
135
+ } else {
136
+ ka
137
+ }
133
138
}
134
139
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
- ) ) ) ]
142
140
fn ka_with_retries ( ka : TcpKeepalive , retries : u32 , dirty : & mut bool ) -> TcpKeepalive {
143
- * dirty = true ;
144
- ka. with_retries ( retries)
145
- }
146
-
147
- #[ cfg( any(
148
- target_os = "aix" ,
149
- target_os = "openbsd" ,
150
- target_os = "redox" ,
151
- target_os = "solaris" ,
152
- target_os = "windows"
153
- ) ) ]
154
- fn ka_with_retries ( ka : TcpKeepalive , _: u32 , _: & mut bool ) -> TcpKeepalive {
155
- ka // no-op as keepalive retries is not supported on this platform
141
+ if cfg ! (
142
+ // See https://docs.rs/socket2/0.5.8/src/socket2/lib.rs.html#557-570
143
+ any(
144
+ target_os = "android" ,
145
+ target_os = "dragonfly" ,
146
+ target_os = "freebsd" ,
147
+ target_os = "fuchsia" ,
148
+ target_os = "illumos" ,
149
+ target_os = "ios" ,
150
+ target_os = "visionos" ,
151
+ target_os = "linux" ,
152
+ target_os = "macos" ,
153
+ target_os = "netbsd" ,
154
+ target_os = "tvos" ,
155
+ target_os = "watchos" ,
156
+ )
157
+ ) {
158
+ * dirty = true ;
159
+ ka. with_retries ( retries)
160
+ } else {
161
+ ka
162
+ }
156
163
}
157
164
}
158
165
You can’t perform that action at this time.
0 commit comments