diff options
| author | tv <tv@krebsco.de> | 2026-11-04 19:45:14 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-04 19:45:14 +0100 |
| commit | 07ef1e4e562d977e72f0a6b702736ae3645b45c7 (patch) | |
| tree | c48b0917f602d63f95ef195c899069a16380eefb /src/swarm/peer/keepalive.rs | |
| parent | d2c1fb0b87a4c74a7f18ec9ad0a62e2c195523a0 (diff) | |
hello again when heard from
While we wait for a peer's HELLO_REPLY, anything else that comes from it
makes our HELLO go again at once, at most once a second, instead of when
the backoff says.
Diffstat (limited to 'src/swarm/peer/keepalive.rs')
| -rw-r--r-- | src/swarm/peer/keepalive.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/swarm/peer/keepalive.rs b/src/swarm/peer/keepalive.rs index 0f34eb8..aa34e70 100644 --- a/src/swarm/peer/keepalive.rs +++ b/src/swarm/peer/keepalive.rs @@ -84,7 +84,10 @@ pub(super) async fn note_alive(state: &AppState, peer: &str, message: &ParsedMes return; }; let ping = matches!(message, ParsedMessage::Ping(_)); + let mut hello_now = false; let (reactivated, _) = heard_from(state, peer, &peer_state, now, |peer_state| { + // Up and reaching us, while we wait for its HELLO_REPLY. + hello_now = peer_state.hello_again_now(now); if ping { // Its keepalive (or a path probe): the next is ours. peer_state.keepalive_received_at = Some(now); @@ -94,6 +97,9 @@ pub(super) async fn note_alive(state: &AppState, peer: &str, message: &ParsedMes } }) .await; + if hello_now { + state.peers_due.now(); + } if reactivated { ensure_handshake(state, peer).await; } |
