radicle-heartwood-lfs/crates/radicle-protocol/src
Adrian Duke a294e05730 radicle-node: Prevent infinite connection loop on instant dial failure
When a connection drops and the node attempts to reconnect within the
same second, the `last_attempt` timestamp written to the database is
identitcal to the `last_success` timestamp due to the Unix time (seconds)
precision loss.

The `maintain_connections` logic filters eligible peers using the
condition `last_success >= last_attempt`. Because the truncated
timestamps are equal, this evaluates to true, causing the node to
bypass the `CONNECTION_RETRY_DELTA` backoff.

If the OS instantly rejects the dial attempt (e.g. `EHOSTUNREACH`),
the node synchronously queues another connection attempt. This traps
the reactor in an infinite `while` loop.

Changing the condition to `last_success > last_attempt` ensures that a
failed attempt in the same second correctly evaluates to false, forcing
the node to respect the backoff timer and breaking the loop.
2026-06-05 18:27:16 +01:00
..
fetcher treewide: Spelling 2026-04-30 15:50:29 -04:00
service protocol: provide more information for invalid timestamps 2026-05-18 18:06:26 +02:00
wire just: checking for ellipses 2026-05-28 16:52:02 +01:00
worker protocol: Minimize scope of `radicle::git::raw` 2026-04-28 14:35:38 +02:00
bounded.rs just: checking for ellipses 2026-05-28 16:52:02 +01:00
deserializer.rs treewide: Spelling 2026-04-30 15:50:29 -04:00
fetcher.rs protocol: Allow configuration of `radicle_fetch::Config` 2026-03-24 14:40:42 +00:00
lib.rs protocol: Introduce `FetcherState` 2026-02-05 20:04:28 +01:00
service.rs radicle-node: Prevent infinite connection loop on instant dial failure 2026-06-05 18:27:16 +01:00
wire.rs treewide/test: Use `impl Arbitrary for Oid` 2026-04-28 14:35:38 +02:00
worker.rs protocol: Allow configuration of `radicle_fetch::Config` 2026-03-24 14:40:42 +00:00