Repository navigation
v0.9.0
mtorrent v0.9.0
This release adds a seeding mode and lets you stop a download instantly with a separate cancel signal. It also fixes a uTP reconnection bug and reworks how the DHT limits and tracks its queries. It includes breaking API changes in the mtorrent and mtorrent-dht library crates.
Highlights
Seeding mode (--seed)
- CLI: the new
--seedflag keeps uploading to peers after the download is complete, until you press Ctrl+C. - Library: the new
app::main::Modesetting inapp::main::Config:Mode::Leech(the default) exits once the download is complete and every active leech has received some data.Mode::Seederkeeps uploading until cancelled.
Immediate cancellation
- Stopping a download:
single_torrent()now takes acancelfuture. The download stops as soon as that future resolves, instead of waiting for the next state snapshot. - Saving progress: progress is written to disk every few seconds, only when it has changed, and once more before returning. This no longer depends on the listener's snapshot interval.
- CLI: Ctrl+C now takes effect immediately, and the CLI logs a state snapshot every 10 seconds.
Full piece bitfield in state snapshots
PiecesSnapshot now has a bitfield field listing which pieces have been downloaded. It is serialized as a string of 0s and 1s. The snapshot types also implement Debug now.
Breaking changes
mtorrent
app::main::single_torrent:- It takes a new
cancel: impl Future<Output = ()>argument, placed betweenlistenerandcfg. - It returns
io::Result<Outcome>instead ofio::Result<()>.Outcomeis eitherFinishedorCancelled. - Don't stop a download by dropping the returned future. Background tasks would then be aborted instead of shut down cleanly, and UPnP port mappings would not be removed. Resolve
canceland wait for the future to complete instead.
- It takes a new
utils::listener::StateListener::on_snapshot:- It now returns
()instead ofControlFlow<()>. Listeners can no longer stop the download; usecancelfor that. - It is called as soon as each stage (metadata, then content) starts, and then every
INTERVAL.
- It now returns
app::main::Confighas a newmodefield.utils::listener::PiecesSnapshothas a new publicbitfieldfield.
mtorrent-dht
- Concurrency limit: the limit on outstanding outbound queries now applies to each operation (for example, each search) instead of globally.
- It moved from
dht::setup_queries(...)todht::Processor::new(config_dir, outbound_queries, max_concurrent_queries). setup_queriesnow takes(outgoing_msgs_sink, incoming_msgs_source, query_timeout).
- It moved from
- Renamed values: the values returned by
setup_querieswere renamed fromclient, servertooutbound_queries, inbound_queries, and the README and crate docs use the new names. dht_nodebinary:--parallel-queriesnow sets the limit per operation.0runs the node as a passive server.
Improvements
- DHT node tracking: the DHT now remembers every recently probed node, not only the ones that answered well. It uses a bounded set of 128K entries, so the same nodes aren't probed over and over.
- DHT bootstrap addresses: bootstrap nodes that resolve to disallowed remote IP addresses are now skipped.
- Documentation: the
mtorrentcrate is now fully documented, and CI fails if a public item has no docs.
Bug fixes
- uTP reconnect between stages: after the metadata download, mtorrent reconnects to the same peer over uTP. A late FIN packet from the old connection could be mistaken for the reply to the new connection request. The new connection then failed and the download hung. The handshake now ignores packets that belong to the old connection.
- uTP connect errors: failed uTP connection attempts now return meaningful
io::ErrorKindvalues:ConnectionResetwhen the peer answers with RESET.UnexpectedEofwhen it answers with FIN.InvalidDatafor any other unexpected packet (previously a genericOthererror).
Internal
- Integration tests: a test could connect to peers left over from another test; this is fixed.
- Dependencies:
tokio-utildefault features are off across the workspace. Onlymtorrent-dhtenables thetimefeature.
To see every change, run git log v0.8.0..v0.9.0.