Hide unnecessary error checking from the user
This affects the `set_non_blocking` function which cannot fail for Unix or Windows, given correct parameters. Additionally, the short UDP write error case has been removed as there is no such thing as "short UDP writes", instead, the operating system will error out if the application tries to send a packet larger than the MTU of the network path.
This commit is contained in:
parent
f0f7ca27de
commit
d0c589d5ce
8 changed files with 35 additions and 29 deletions
|
@ -214,9 +214,9 @@ pub fn wouldblock() -> bool {
|
|||
err == libc::EWOULDBLOCK as i32 || err == libc::EAGAIN as i32
|
||||
}
|
||||
|
||||
pub fn set_nonblocking(fd: sock_t, nb: bool) -> IoResult<()> {
|
||||
pub fn set_nonblocking(fd: sock_t, nb: bool) {
|
||||
let set = nb as libc::c_int;
|
||||
mkerr_libc(retry(|| unsafe { c::ioctl(fd, c::FIONBIO, &set) }))
|
||||
mkerr_libc(retry(|| unsafe { c::ioctl(fd, c::FIONBIO, &set) })).unwrap();
|
||||
}
|
||||
|
||||
// nothing needed on unix platforms
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue