We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
set_non_blocking
1 parent d0c589d commit 0fc1a7dCopy full SHA for 0fc1a7d
src/libstd/sys/windows/mod.rs
@@ -194,11 +194,11 @@ pub fn wouldblock() -> bool {
194
195
pub fn set_nonblocking(fd: sock_t, nb: bool) {
196
let mut set = nb as libc::c_ulong;
197
- (if unsafe { c::ioctlsocket(fd, c::FIONBIO, &mut set) } != 0 {
198
- Err(last_error())
199
- } else {
200
- Ok(())
201
- }).unwrap();
+ if unsafe { c::ioctlsocket(fd, c::FIONBIO, &mut set) } != 0 {
+ // The above function should not return an error unless we passed it
+ // invalid parameters. Panic on errors.
+ Err(last_error()).unwrap();
+ }
202
}
203
204
pub fn init_net() {
0 commit comments