Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Connect to peers on startup
cloudhead committed 2 years ago
commit 508cf4f68cf3830cc256457700528ca1cb3726c9
parent 27865a26b27cd861029ec68fa7da6a33bb8bda5c
2 files changed +5 -2
modified radicle-node/src/service.rs
@@ -428,6 +428,8 @@ where
                .repo_policies()?
                .filter_map(|t| (t.policy == tracking::Policy::Track).then_some(t.id)),
        );
+
        // Try to establish some connections.
+
        self.maintain_connections();
        // Start periodic tasks.
        self.outbox.wakeup(IDLE_INTERVAL);

modified radicle-node/src/tests.rs
@@ -1015,7 +1015,6 @@ fn test_maintain_connections() {
    ];

    let mut alice = Peer::new("alice", [7, 7, 7, 7]);
-
    alice.import_addresses(&unconnected);

    for peer in connected.iter() {
        alice.connect_to(peer);
@@ -1023,8 +1022,10 @@ fn test_maintain_connections() {
    assert_eq!(
        connected.len(),
        alice.sessions().len(),
-
        "alice should be connected to all peers"
+
        "alice should be connected to the first set of peers"
    );
+
    // We now import the other addresses.
+
    alice.import_addresses(&unconnected);

    // A transient error such as this will cause Alice to attempt a reconnection.
    let error = Arc::new(io::Error::from(io::ErrorKind::ConnectionReset));