Skip to content

Commit

Permalink
iroh-net: Use BTreeSet for AddrInfo (#1672)
Browse files Browse the repository at this point in the history
## Description

rationale: this way the serialized representation of AddrInfo and all
the things that contain AddrInfo is unique instead of constantly
toggling when there are 2 or more addrs.)

## Notes & open questions

Is there any place that will only work if the addrs are randomized? I
don't think so, and I also don't think we should have it. But you never
know...

## Change checklist

- [ ] Self-review.
- [ ] Documentation updates if relevant.
- [ ] Tests if relevant.
  • Loading branch information
rklaehn authored Oct 19, 2023
1 parent 1b5760d commit a93e89e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions iroh-net/src/magic_endpoint.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! An endpoint that leverages a [quinn::Endpoint] backed by a [magicsock::MagicSock].
use std::{collections::HashSet, net::SocketAddr, path::PathBuf, sync::Arc, time::Duration};
use std::{collections::BTreeSet, net::SocketAddr, path::PathBuf, sync::Arc, time::Duration};

use anyhow::{anyhow, ensure, Context, Result};
use quinn_proto::VarInt;
Expand Down Expand Up @@ -81,7 +81,7 @@ pub struct AddrInfo {
/// The peer's home DERP region.
pub derp_region: Option<u16>,
/// Socket addresses where the peer might be reached directly.
pub direct_addresses: HashSet<SocketAddr>,
pub direct_addresses: BTreeSet<SocketAddr>,
}

impl AddrInfo {
Expand Down

0 comments on commit a93e89e

Please sign in to comment.