Rollup merge of #127300 - biabbas:fix_connect_timeout, r=tgross35 · patricklam/verify-rust-std@886fe5b (original) (raw)
`@@ -214,16 +214,25 @@ impl Socket {
`
214
214
`}
`
215
215
`0 => {}
`
216
216
` _ => {
`
217
``
`-
// linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look
`
218
``
`-
// for POLLHUP rather than read readiness
`
219
``
`-
if pollfd.revents & libc::POLLHUP != 0 {
`
220
``
`-
let e = self.take_error()?.unwrap_or_else(|| {
`
221
``
`-
io::const_io_error!(
`
222
``
`-
io::ErrorKind::Uncategorized,
`
223
``
`-
"no error set after POLLHUP",
`
224
``
`-
)
`
225
``
`-
});
`
226
``
`-
return Err(e);
`
``
217
`+
if cfg!(target_os = "vxworks") {
`
``
218
`+
// VxWorks poll does not return POLLHUP or POLLERR in revents. Check if the
`
``
219
`+
// connnection actually succeeded and return ok only when the socket is
`
``
220
`+
// ready and no errors were found.
`
``
221
`+
if let Some(e) = self.take_error()? {
`
``
222
`+
return Err(e);
`
``
223
`+
}
`
``
224
`+
} else {
`
``
225
`+
// linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look
`
``
226
`+
// for POLLHUP or POLLERR rather than read readiness
`
``
227
`+
if pollfd.revents & (libc::POLLHUP | libc::POLLERR) != 0 {
`
``
228
`+
let e = self.take_error()?.unwrap_or_else(|| {
`
``
229
`+
io::const_io_error!(
`
``
230
`+
io::ErrorKind::Uncategorized,
`
``
231
`+
"no error set after POLLHUP",
`
``
232
`+
)
`
``
233
`+
});
`
``
234
`+
return Err(e);
`
``
235
`+
}
`
227
236
`}
`
228
237
``
229
238
`return Ok(());
`