Skip to content

Commit

Permalink
udp: use io::Result<> where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
stormshield-damiend authored and Ralith committed Jan 8, 2024
1 parent 6e3d108 commit 20dff91
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion quinn-udp/src/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl UdpSocketState {
socket: UdpSockRef<'_>,
_state: &UdpState,
transmits: &[Transmit],
) -> Result<usize, io::Error> {
) -> io::Result<usize> {
let mut sent = 0;
for transmit in transmits {
match socket.0.send_to(
Expand Down
6 changes: 3 additions & 3 deletions quinn-udp/src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl UdpSocketState {
})
}

pub fn send(&self, socket: UdpSockRef<'_>, transmits: &[Transmit]) -> Result<usize, io::Error> {
pub fn send(&self, socket: UdpSockRef<'_>, transmits: &[Transmit]) -> io::Result<usize> {
send(self, socket.0, transmits)
}

Expand Down Expand Up @@ -823,7 +823,7 @@ fn set_socket_option_supported(
level: libc::c_int,
name: libc::c_int,
value: libc::c_int,
) -> Result<bool, io::Error> {
) -> io::Result<bool> {
match set_socket_option(socket, level, name, value) {
Ok(()) => Ok(true),
Err(err) if err.raw_os_error() == Some(libc::ENOPROTOOPT) => Ok(false),
Expand All @@ -836,7 +836,7 @@ fn set_socket_option(
level: libc::c_int,
name: libc::c_int,
value: libc::c_int,
) -> Result<(), io::Error> {
) -> io::Result<()> {
let rc = unsafe {
libc::setsockopt(
socket.as_raw_fd(),
Expand Down
2 changes: 1 addition & 1 deletion quinn-udp/src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ fn set_socket_option(
level: i32,
name: i32,
value: u32,
) -> Result<(), io::Error> {
) -> io::Result<()> {
let rc = unsafe {
WinSock::setsockopt(
socket.as_raw_socket() as usize,
Expand Down

0 comments on commit 20dff91

Please sign in to comment.