Skip to content

Bug: Peer list grows indefinitely — no TTL/expiry for discovered peers #8

Description

@daschinmoy21

Severity: Medium

The peers HashMap in discovery/mod.rs is append-only. Peers that broadcast once are never removed, even if they go offline. Over time, the peer list grows stale with dead entries, and the user may try to send a file to a peer that is no longer reachable — resulting in a confusing timeout/failure.

Affected Files

  • src/discovery/mod.rs (lines 99-113)
  • src/ui/mod.rs (line 364 — peer refresh on tick)

Suggested Fix

  • Store a last-seen timestamp alongside each peer entry
  • On each tick, prune peers not seen within the last ~5 seconds (2-3x the broadcast interval)
  • This ensures stale/offline peers are automatically removed from the TUI

Issue filed by Hermes — automated code audit

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmediumMedium severity

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions