We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 66b4f00 commit 08379a8Copy full SHA for 08379a8
library/std/src/sys/pal/unix/net.rs
@@ -213,15 +213,9 @@ impl Socket {
213
}
214
0 => {}
215
_ => {
216
- // linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look
217
- // for POLLHUP rather than read readiness
218
- if pollfd.revents & libc::POLLHUP != 0 {
219
- let e = self.take_error()?.unwrap_or_else(|| {
220
- io::const_io_error!(
221
- io::ErrorKind::Uncategorized,
222
- "no error set after POLLHUP",
223
- )
224
- });
+ // Check if the connnection actually succeeded and return ok only when
+ // the socket is ready and no errors were found
+ if let Some(e) = self.take_error()? {
225
return Err(e);
226
227
0 commit comments