Skip to content

Commit 7e40d68

Browse files
update iroh-quinn
1 parent 243aa01 commit 7e40d68

File tree

2 files changed

+33
-27
lines changed

2 files changed

+33
-27
lines changed

Cargo.lock

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

iroh/src/magicsock.rs

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ use std::{
2222
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
2323
pin::Pin,
2424
sync::{
25-
atomic::{AtomicBool, AtomicU64, Ordering},
2625
Arc, Mutex, RwLock,
26+
atomic::{AtomicBool, AtomicU64, Ordering},
2727
},
2828
task::{Context, Poll},
2929
};
@@ -33,24 +33,24 @@ use data_encoding::HEXLOWER;
3333
use iroh_base::{NodeAddr, NodeId, PublicKey, RelayUrl, SecretKey};
3434
use iroh_relay::RelayMap;
3535
use n0_future::{
36+
StreamExt,
3637
boxed::BoxStream,
3738
task::{self, AbortOnDropHandle},
3839
time::{self, Duration, Instant},
39-
StreamExt,
4040
};
4141
use n0_watcher::{self, Watchable, Watcher};
4242
use nested_enum_utils::common_fields;
4343
use netwatch::netmon;
4444
#[cfg(not(wasm_browser))]
45-
use netwatch::{ip::LocalAddresses, UdpSocket};
45+
use netwatch::{UdpSocket, ip::LocalAddresses};
4646
use quinn::{AsyncUdpSocket, ServerConfig};
4747
use rand::Rng;
4848
use smallvec::SmallVec;
4949
use snafu::{ResultExt, Snafu};
50-
use tokio::sync::{mpsc, Mutex as AsyncMutex};
50+
use tokio::sync::{Mutex as AsyncMutex, mpsc};
5151
use tokio_util::sync::CancellationToken;
5252
use tracing::{
53-
debug, error, event, info, info_span, instrument, trace, trace_span, warn, Instrument, Level,
53+
Instrument, Level, debug, error, event, info, info_span, instrument, trace, trace_span, warn,
5454
};
5555
use transports::LocalAddrsWatch;
5656
use url::Url;
@@ -72,7 +72,7 @@ use crate::{
7272
defaults::timeouts::NET_REPORT_TIMEOUT,
7373
disco::{self, SendAddr},
7474
discovery::{Discovery, DiscoveryItem, DiscoverySubscribers, NodeData, UserData},
75-
key::{public_ed_box, secret_ed_box, DecryptionError, SharedSecret},
75+
key::{DecryptionError, SharedSecret, public_ed_box, secret_ed_box},
7676
metrics::EndpointMetrics,
7777
net_report::{self, IfStateDetails, IpMappedAddresses, Report},
7878
};
@@ -2415,22 +2415,23 @@ mod tests {
24152415

24162416
use data_encoding::HEXLOWER;
24172417
use iroh_base::{NodeAddr, NodeId, PublicKey};
2418-
use n0_future::{time, StreamExt};
2418+
use n0_future::{StreamExt, time};
24192419
use n0_snafu::{Result, ResultExt};
24202420
use n0_watcher::Watcher;
24212421
use quinn::ServerConfig;
24222422
use rand::{Rng, RngCore};
24232423
use tokio::task::JoinSet;
24242424
use tokio_util::task::AbortOnDropHandle;
2425-
use tracing::{error, info, info_span, instrument, Instrument};
2425+
use tracing::{Instrument, error, info, info_span, instrument};
24262426
use tracing_test::traced_test;
24272427

24282428
use super::{NodeIdMappedAddr, Options};
24292429
use crate::{
2430+
Endpoint, RelayMap, RelayMode, SecretKey,
24302431
dns::DnsResolver,
24312432
endpoint::{DirectAddr, PathSelection, Source},
2432-
magicsock::{node_map, Handle, MagicSock},
2433-
tls, Endpoint, RelayMap, RelayMode, SecretKey,
2433+
magicsock::{Handle, MagicSock, node_map},
2434+
tls,
24342435
};
24352436

24362437
const ALPN: &[u8] = b"n0/test/1";
@@ -2626,10 +2627,12 @@ mod tests {
26262627
info!("stats: {:#?}", stats);
26272628
// TODO: ensure panics in this function are reported ok
26282629
if matches!(loss, ExpectedLoss::AlmostNone) {
2629-
assert!(
2630-
stats.path.lost_packets < 10,
2631-
"[receiver] should not loose many packets",
2632-
);
2630+
for (id, path) in &stats.paths {
2631+
assert!(
2632+
path.lost_packets < 10,
2633+
"[receiver] path {id:?} should not loose many packets",
2634+
);
2635+
}
26332636
}
26342637

26352638
info!("close");
@@ -2677,10 +2680,12 @@ mod tests {
26772680
let stats = conn.stats();
26782681
info!("stats: {:#?}", stats);
26792682
if matches!(loss, ExpectedLoss::AlmostNone) {
2680-
assert!(
2681-
stats.path.lost_packets < 10,
2682-
"[sender] should not loose many packets",
2683-
);
2683+
for (id, path) in &stats.paths {
2684+
assert!(
2685+
path.lost_packets < 10,
2686+
"[sender] path {id:?} should not loose many packets",
2687+
);
2688+
}
26842689
}
26852690

26862691
info!("close");
@@ -3272,10 +3277,11 @@ mod tests {
32723277
.magic_sock()
32733278
.add_node_addr(empty_addr, node_map::Source::App)
32743279
.unwrap_err();
3275-
assert!(err
3276-
.to_string()
3277-
.to_lowercase()
3278-
.contains("empty addressing info"));
3280+
assert!(
3281+
err.to_string()
3282+
.to_lowercase()
3283+
.contains("empty addressing info")
3284+
);
32793285

32803286
// relay url only
32813287
let addr = NodeAddr {

0 commit comments

Comments
 (0)