diff options
| author | Fenrir <[email protected]> | 2018-02-13 12:49:15 -0700 |
|---|---|---|
| committer | Fenrir <[email protected]> | 2018-02-13 12:52:38 -0700 |
| commit | 8e800951df553695bf7ba6af2e97a45e1c535e54 (patch) | |
| tree | 13617fd75bc4a666275127a9def671c34f2dbf52 /ctr-std/src/sys | |
| parent | Don't use ioctl for TcpStream::connect_timeout (diff) | |
| download | ctru-rs-8e800951df553695bf7ba6af2e97a45e1c535e54.tar.xz ctru-rs-8e800951df553695bf7ba6af2e97a45e1c535e54.zip | |
Fix TcpStream::wait_timeout
POLLOUT is 0x4 and PULLHUP is 0x10 on every other platform, except for the 3DS where they're switched around because Nintendo
Diffstat (limited to 'ctr-std/src/sys')
| -rw-r--r-- | ctr-std/src/sys/unix/net.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ctr-std/src/sys/unix/net.rs b/ctr-std/src/sys/unix/net.rs index b41dc1f..a056aec 100644 --- a/ctr-std/src/sys/unix/net.rs +++ b/ctr-std/src/sys/unix/net.rs @@ -143,7 +143,7 @@ impl Socket { let mut pollfd = libc::pollfd { fd: self.0.raw(), - events: libc::POLLOUT, + events: 0x10, //libc::POLLOUT; value in the `libc` crate is currently incorrect revents: 0, }; @@ -181,7 +181,9 @@ impl Socket { _ => { // linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look // for POLLHUP rather than read readiness - if pollfd.revents & libc::POLLHUP != 0 { + // + // libc::POLLHUP should be 0x4. the `libc` crate incorrectly lists it as 0x10 + if pollfd.revents & 0x4 != 0 { let e = self.take_error()? .unwrap_or_else(|| { io::Error::new(io::ErrorKind::Other, "no error set after POLLHUP") |