Skip to content

Commit 761a0e9

Browse files
chore: update to latest iroh-quinn-udp
1 parent 0a73ffa commit 761a0e9

4 files changed

Lines changed: 16 additions & 9 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ unexpected_cfgs = { level = "warn", check-cfg = ["cfg(iroh_docsrs)"] }
3737

3838
[workspace.lints.clippy]
3939
unused-async = "warn"
40+
41+
[patch.crates-io]
42+
iroh-quinn-udp = { git = "https://github.com/n0-computer/quinn", branch = "main" }

deny.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ ignore = [
2323
"RUSTSEC-2024-0436", # paste unmaintained
2424
"RUSTSEC-2023-0089", # atomic-polyfill unmaintained
2525
]
26+
27+
[sources]
28+
allow-git = [
29+
"https://github.com/n0-computer/quinn"
30+
]

netwatch/src/udp.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::{
22
future::Future,
33
io,
44
net::SocketAddr,
5+
num::NonZeroUsize,
56
pin::Pin,
67
sync::{Arc, RwLock, RwLockReadGuard, TryLockError, atomic::AtomicBool},
78
task::{Context, Poll},
@@ -463,7 +464,7 @@ impl UdpSocket {
463464
///
464465
/// This is 1 if the platform doesn't support GSO. Subject to change if errors are detected
465466
/// while using GSO.
466-
pub fn max_gso_segments(&self) -> usize {
467+
pub fn max_gso_segments(&self) -> NonZeroUsize {
467468
let guard = self.socket.read().unwrap();
468469
guard.max_gso_segments()
469470
}
@@ -472,7 +473,7 @@ impl UdpSocket {
472473
/// compute the receive buffer size.
473474
///
474475
/// Returns 1 if the platform doesn't support GRO.
475-
pub fn gro_segments(&self) -> usize {
476+
pub fn gro_segments(&self) -> NonZeroUsize {
476477
let guard = self.socket.read().unwrap();
477478
guard.gro_segments()
478479
}
@@ -687,8 +688,8 @@ enum SocketState {
687688
addr: SocketAddr,
688689
},
689690
Closed {
690-
last_max_gso_segments: usize,
691-
last_gro_segments: usize,
691+
last_max_gso_segments: NonZeroUsize,
692+
last_gro_segments: NonZeroUsize,
692693
last_may_fragment: bool,
693694
},
694695
}
@@ -818,7 +819,7 @@ impl SocketState {
818819
}
819820
}
820821

821-
fn max_gso_segments(&self) -> usize {
822+
fn max_gso_segments(&self) -> NonZeroUsize {
822823
match self {
823824
Self::Connected { state, .. } => state.max_gso_segments(),
824825
Self::Closed {
@@ -828,7 +829,7 @@ impl SocketState {
828829
}
829830
}
830831

831-
fn gro_segments(&self) -> usize {
832+
fn gro_segments(&self) -> NonZeroUsize {
832833
match self {
833834
Self::Connected { state, .. } => state.gro_segments(),
834835
Self::Closed {
@@ -840,7 +841,6 @@ impl SocketState {
840841

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

0 commit comments

Comments
 (0)