aboutsummaryrefslogtreecommitdiff
path: root/ctr-std/src/sys/horizon
diff options
context:
space:
mode:
authorFenrir <[email protected]>2018-08-19 17:48:00 -0600
committerFenrir <[email protected]>2018-08-19 17:56:18 -0600
commit5d28bfcfd6086c3328837de9695099ea39048d0d (patch)
treea514fde042ff2a504a03305bfe0894ff8cd8d47e /ctr-std/src/sys/horizon
parentUpdate for latest nightly 2018-06-09 (#70) (diff)
downloadctru-rs-5d28bfcfd6086c3328837de9695099ea39048d0d.tar.xz
ctru-rs-5d28bfcfd6086c3328837de9695099ea39048d0d.zip
Update for nightly-2018-08-18
Diffstat (limited to 'ctr-std/src/sys/horizon')
-rw-r--r--ctr-std/src/sys/horizon/net.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/ctr-std/src/sys/horizon/net.rs b/ctr-std/src/sys/horizon/net.rs
index b6af433..14c58eb 100644
--- a/ctr-std/src/sys/horizon/net.rs
+++ b/ctr-std/src/sys/horizon/net.rs
@@ -148,7 +148,9 @@ impl Socket {
let mut pollfd = libc::pollfd {
fd: self.0.raw(),
- events: libc::POLLOUT,
+ // supposed to be `libc::POLLOUT`, but the value in the `libc` crate is currently
+ // incorrect for the 3DS
+ events: 0x10,
revents: 0,
};
@@ -184,9 +186,9 @@ impl Socket {
}
0 => {}
_ => {
- // 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, but the constant is currently defined
+ // incorrectly for 3DS. So we just specifiy it manually for now.
+ if pollfd.revents & 0x4 != 0 {
let e = self.take_error()?
.unwrap_or_else(|| {
io::Error::new(io::ErrorKind::Other, "no error set after POLLHUP")
@@ -343,8 +345,7 @@ impl Socket {
}
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
- let mut nonblocking = nonblocking as libc::c_int;
- cvt(unsafe { libc::ioctl(*self.as_inner(), libc::FIONBIO as u32, &mut nonblocking) }).map(|_| ())
+ self.0.set_nonblocking(nonblocking)
}
pub fn take_error(&self) -> io::Result<Option<io::Error>> {