diff options
| author | tv <tv@krebsco.de> | 2026-10-25 21:49:54 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-25 21:49:54 +0100 |
| commit | 4efa5a7c0f5d51c16ff87a3873e024cb2a336714 (patch) | |
| tree | 6dcdd2b9a66ea47dad1009c336d834699286bee8 | |
| parent | 260c100bd973fefa11478cb61b1d8b4e08308d76 (diff) | |
newly added neighbour get a sync attempt
| -rw-r--r-- | src/swarm/peer.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/swarm/peer.rs b/src/swarm/peer.rs index 238194c..fc37ec2 100644 --- a/src/swarm/peer.rs +++ b/src/swarm/peer.rs @@ -406,15 +406,24 @@ async fn discover_peers(state: &AppState, from_peer: &str, advertised_peers: &[S } /// New neighbours get our HELLO (we may not have known them before: the member list is -/// how a partial mesh discovers them). Former neighbours get no more HELLOs, keepalives -/// or sync openings from us; their session is reset, so we don't keep pushing changes -/// to them either. They are still answered if they contact us. +/// how a partial mesh discovers them) and a sync opening. The opening matters for a +/// neighbour whose handshake is already complete, e.g. one that returned from dormancy +/// while it wasn't our neighbour: it was only answered then, and with no HELLO to send, +/// nothing else would open sync until the keepalive heal (`resync_after`). Former +/// neighbours get no more HELLOs, keepalives or sync openings from us; their session is +/// reset, so we don't keep pushing changes to them either. They are still answered if +/// they contact us. async fn apply_neighbour_change(state: &AppState, change: topology::NeighbourChange) { for peer in &change.added { remember_peer(state, peer).await; if let Err(error) = send_hello_once(state, peer).await { warn!(peer = %peer, error = %format!("{error:#}"), "HELLO to new neighbour failed; will retry"); } + // Skipped there unless the handshake is complete; otherwise its reply restarts + // sync anyway. + let _ = state + .sync_events + .send(SyncEvent::PeerNeedsSync(peer.clone())); } for peer in &change.removed { if let Some(peer_state) = state.get_peer_state(peer).await { |
