Skip to content

Commit

Permalink
Notify peer about changes to external addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Nov 15, 2023
1 parent 61dd80a commit 6eadee7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/subspace-networking/src/node_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,15 @@ where
}
SwarmEvent::ExternalAddrConfirmed { address } => {
info!(%address, "Confirmed external address");

let connected_peers = self.swarm.connected_peers().copied().collect::<Vec<_>>();
self.swarm.behaviour_mut().identify.push(connected_peers);
}
SwarmEvent::ExternalAddrExpired { address } => {
info!(%address, "External address expired");

let connected_peers = self.swarm.connected_peers().copied().collect::<Vec<_>>();
self.swarm.behaviour_mut().identify.push(connected_peers);
}
other => {
trace!("Other swarm event: {:?}", other);
Expand Down Expand Up @@ -1159,6 +1168,9 @@ where
self.swarm.remove_external_address(&old_address);
// Trigger potential mode change manually
self.swarm.behaviour_mut().kademlia.set_mode(None);

let connected_peers = self.swarm.connected_peers().copied().collect::<Vec<_>>();
self.swarm.behaviour_mut().identify.push(connected_peers);
}
}
}
Expand Down

0 comments on commit 6eadee7

Please sign in to comment.