aboutsummaryrefslogtreecommitdiff
path: root/ctr-std/src/sys
diff options
context:
space:
mode:
authorFenrir <[email protected]>2018-02-13 12:49:15 -0700
committerFenrir <[email protected]>2018-02-13 12:52:38 -0700
commit8e800951df553695bf7ba6af2e97a45e1c535e54 (patch)
tree13617fd75bc4a666275127a9def671c34f2dbf52 /ctr-std/src/sys
parentDon't use ioctl for TcpStream::connect_timeout (diff)
downloadctru-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.rs6
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")