Skip to content

v1.1.0 — Your node remembers the network

Choose a tag to compare

@andrewhack andrewhack released this 07 Aug 16:40
· 302 commits to main since this release

v1.1.0 — Your node remembers the network

Until now, every time this server started it had to ask someone else where the BitTorrent network
was.

Joining the DHT requires an entry point. With nothing saved, libtorrent falls back to its built-in
bootstrap routers — a handful of hostnames operated by two organisations. That happened on every
boot. The DHT itself is decentralised and can't be switched off, but joining it was a
chokepoint: if those names ever stop resolving, a freshly started node never finds its first peer,
even though the swarm is alive and it's holding perfectly good infohashes.

From 1.1.0 the server remembers. It writes its DHT routing table to <cache>/dht.state and
restores it on start. A machine that has been online even once rejoins through hundreds of peers it
already knows — nobody else's server in the path.

Why this matters for a box that sits idle

The routing table is saved every 30 seconds, alongside resume data — not only on a clean
shutdown. An appliance gets unplugged, not shut down. Saving only on graceful exit would have meant
the machines most likely to sit powered off for months were exactly the ones that never kept a
routing table.

It fails quietly, on purpose

  • Missing or corrupt state file → normal cold start. A box that won't boot is worse than one that
    takes an extra minute to find peers.
  • A failed save never propagates. The same background thread persists your playback progress, and
    losing that to protect a routing table would be a bad trade.
  • Your current settings always win over whatever was saved, so a stale listen port or rate limit
    can't outlive the config that replaced it.

New setting

Env var Default What it does
STREMIOSRV_DHT_BOOTSTRAP_NODES (empty) Your own DHT entry points, host:port,host:port. Empty keeps libtorrent's built-in routers. Only used on a genuine first boot — after that the saved routing table takes over.

Nothing to configure otherwise. Upgrade, and the first run starts building the table.

Upgrade notes

No breaking changes. <cache>/dht.state appears after the first 30 seconds of uptime; delete it
any time to force a clean re-bootstrap.


Full changes: git log v1.0.4..v1.1.0