mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-19 09:45:20 +00:00
udp: use io::Result<> where possible
This commit is contained in:
committed by
Benjamin Saunders
parent
6e3d10857e
commit
20dff915e1
@@ -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(
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
@@ -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(),
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user