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 | 291ebf267f7b4f6fb3c3c3e95b37a1ce7dc84aeb (patch) | |
| tree | c9e627623269c65867e11b97bb68348c17a23e5b /src | |
| parent | 2bd589e2900544ee839d87acda92e82e6c3585ce (diff) | |
newly added neighbour get a sync attempt
Diffstat (limited to 'src')
| -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 { |
