Skip to content

Commit bac4c28

Browse files
committed
improve naming
1 parent 95fdddb commit bac4c28

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

iroh-net/src/conn_manager.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ mod tests {
369369
use futures_lite::StreamExt;
370370
use tokio::task::JoinSet;
371371

372-
use crate::test_utils::TestEndpointFactory;
372+
use crate::test_utils::TestEndpointBuilder;
373373

374374
use super::{ConnManager, HandleConnectionSender};
375375

@@ -390,16 +390,16 @@ mod tests {
390390
#[tokio::test]
391391
async fn test_conn_manager() -> anyhow::Result<()> {
392392
let _guard = iroh_test::logging::setup();
393-
let mut factory = TestEndpointFactory::run().await?;
393+
let mut builder = TestEndpointBuilder::run().await?;
394394

395395
let alpns = vec![TEST_ALPN.to_vec()];
396-
let ep1 = factory.create_endpoint(alpns.clone()).await?;
397-
let ep2 = factory.create_endpoint(alpns.clone()).await?;
396+
let ep1 = builder.create_endpoint(alpns.clone()).await?;
397+
let ep2 = builder.create_endpoint(alpns.clone()).await?;
398398
let n1 = ep1.node_id();
399399
let n2 = ep2.node_id();
400400
tracing::info!(?n1, ?n2, "endpoints created");
401-
factory.on_node(&n1, Duration::from_secs(2)).await?;
402-
factory.on_node(&n2, Duration::from_secs(2)).await?;
401+
builder.on_node(&n1, Duration::from_secs(2)).await?;
402+
builder.on_node(&n2, Duration::from_secs(2)).await?;
403403

404404
let mut conn_manager1 = ConnManager::new(ep1.clone(), TEST_ALPN);
405405
let mut conn_manager2 = ConnManager::new(ep2.clone(), TEST_ALPN);

iroh-net/src/test_utils.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,20 @@ pub async fn run_relay_server() -> Result<(RelayMap, RelayUrl, CleanupDropGuard)
7070
Ok((m, url, CleanupDropGuard(tx)))
7171
}
7272

73-
/// A factory for endpoints with preconfigured local discovery and relays.
73+
/// A builder for endpoints with preconfigured local discovery and relays.
7474
#[derive(Debug)]
75-
pub struct TestEndpointFactory {
75+
pub struct TestEndpointBuilder {
7676
relay_map: RelayMap,
7777
relay_url: RelayUrl,
7878
_relay_drop_guard: CleanupDropGuard,
7979
dns_pkarr_server: DnsPkarrServer,
8080
rng: rand_chacha::ChaCha12Rng,
8181
}
8282

83-
impl TestEndpointFactory {
84-
/// Starts local relay and discovery servers and returns a [`TestEndpointFactory`] to create
85-
/// readily configured endpoints.
83+
impl TestEndpointBuilder {
84+
/// Starts local relay and discovery servers and returns a builder to create readily configured endpoints.
8685
///
87-
/// The local servers will shut down once the [`TestEndpointFactory`] is dropped.
86+
/// The local relay, DNS and pkarr servers will shut down once the [`TestEndpointBuilder`] is dropped.
8887
pub async fn run() -> anyhow::Result<Self> {
8988
let dns_pkarr_server = DnsPkarrServer::run().await?;
9089
let (relay_map, relay_url, relay_drop_guard) = run_relay_server().await?;

0 commit comments

Comments
 (0)