Repository navigation
Release 0.7.1: restart a DHT that stays empty - #127
Merged
Merged
Conversation
An engine that ran for 11 days through Wi-Fi, hotspot and VPN changes ended up with no DHT nodes and never bootstrapped again: dht.state held only node ids, and a magnet with just an infohash, even Ubuntu's, timed out with "no peer sent its file list" until the engine restarted. The engine now counts the routing table's nodes every minute. Once it has been empty for 2 minutes, it turns the DHT off and on, which adds the bootstrap routers again, and waits twice as long after each restart that finds it still empty, up to 30 minutes, so an offline machine does not churn.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An engine that ran for days through network changes (Wi-Fi, a phone hotspot, Cloudflare WARP on and off) lost every DHT node and never bootstrapped again.
dht.stateshrank to its node ids alone, and any magnet that leans on the DHT failed with "No peer sent its file list" or "No data arrived": even Ubuntu 26.10 by bare infohash timed out after 60 s, while the same magnet with a tracker listed its files in 6 s. Restarting the engine fixed it at once.The engine now counts the routing table's nodes every minute (
Session::dht_nodes, fromsession_state). After 2 minutes empty it turns the DHT off and on (Session::restart_dht), which adds the bootstrap routers again, and it waits twice as long after each restart that leaves the table empty, up to 30 minutes, so a machine that is offline does not churn.Tested:
cargo test --workspace: all pass exceptthe_engine_keeps_trying_the_home_network_while_another_program_holds_its_port, which passed on its own twice and does not touch the DHT.restart_dht, 232 twenty seconds later.Sets the version to 0.7.1.
🤖 Generated with Claude Code