Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ unexpected_cfgs = { level = "warn", check-cfg = ["cfg(iroh_docsrs)"] }

[workspace.lints.clippy]
unused-async = "warn"

[patch.crates-io]
iroh-quinn-udp = { git = "https://github.com/n0-computer/quinn", branch = "main" }
5 changes: 5 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ ignore = [
"RUSTSEC-2024-0436", # paste unmaintained
"RUSTSEC-2023-0089", # atomic-polyfill unmaintained
]

[sources]
allow-git = [
"https://github.com/n0-computer/quinn"
]
14 changes: 7 additions & 7 deletions netwatch/src/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{
future::Future,
io,
net::SocketAddr,
num::NonZeroUsize,
pin::Pin,
sync::{Arc, RwLock, RwLockReadGuard, TryLockError, atomic::AtomicBool},
task::{Context, Poll},
Expand Down Expand Up @@ -463,7 +464,7 @@ impl UdpSocket {
///
/// This is 1 if the platform doesn't support GSO. Subject to change if errors are detected
/// while using GSO.
pub fn max_gso_segments(&self) -> usize {
pub fn max_gso_segments(&self) -> NonZeroUsize {
let guard = self.socket.read().unwrap();
guard.max_gso_segments()
}
Expand All @@ -472,7 +473,7 @@ impl UdpSocket {
/// compute the receive buffer size.
///
/// Returns 1 if the platform doesn't support GRO.
pub fn gro_segments(&self) -> usize {
pub fn gro_segments(&self) -> NonZeroUsize {
let guard = self.socket.read().unwrap();
guard.gro_segments()
}
Expand Down Expand Up @@ -687,8 +688,8 @@ enum SocketState {
addr: SocketAddr,
},
Closed {
last_max_gso_segments: usize,
last_gro_segments: usize,
last_max_gso_segments: NonZeroUsize,
last_gro_segments: NonZeroUsize,
last_may_fragment: bool,
},
}
Expand Down Expand Up @@ -818,7 +819,7 @@ impl SocketState {
}
}

fn max_gso_segments(&self) -> usize {
fn max_gso_segments(&self) -> NonZeroUsize {
match self {
Self::Connected { state, .. } => state.max_gso_segments(),
Self::Closed {
Expand All @@ -828,7 +829,7 @@ impl SocketState {
}
}

fn gro_segments(&self) -> usize {
fn gro_segments(&self) -> NonZeroUsize {
match self {
Self::Connected { state, .. } => state.gro_segments(),
Self::Closed {
Expand All @@ -840,7 +841,6 @@ impl SocketState {

impl Drop for UdpSocket {
fn drop(&mut self) {
trace!("dropping UdpSocket");
if let Some((socket, _)) = self.socket.write().unwrap().close() {
if let Ok(handle) = tokio::runtime::Handle::try_current() {
// No wakeup after dropping write lock here, since we're getting dropped.
Expand Down
Loading