Skip to content

Commit

Permalink
TcpSocket: don't panic on windows
Browse files Browse the repository at this point in the history
Signed-off-by: Marc-Antoine Perennou <[email protected]>
  • Loading branch information
Keruspe authored and Thomasdezeeuw committed Oct 14, 2020
1 parent e4c7302 commit 872ceda
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/sys/windows/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ pub(crate) fn set_reuseaddr(socket: TcpSocket, reuseaddr: bool) -> io::Result<()
&val as *const _ as *const c_char,
size_of::<BOOL>() as c_int,
) } {
0 => Ok(()),
SOCKET_ERROR => Err(io::Error::last_os_error()),
_ => panic!("unexpected return value"),
_ => Ok(()),
}
}

Expand All @@ -101,9 +100,8 @@ pub(crate) fn set_linger(socket: TcpSocket, dur: Option<Duration>) -> io::Result
&val as *const _ as *const c_char,
size_of::<linger>() as c_int,
) } {
0 => Ok(()),
SOCKET_ERROR => Err(io::Error::last_os_error()),
_ => panic!("unexpected return value"),
_ => Ok(()),
}
}

Expand Down

0 comments on commit 872ceda

Please sign in to comment.