Skip to content

v2.0.0

Compare
Choose a tag to compare
@alanmcgovern alanmcgovern released this 04 May 19:45

General

This is the first stable release of the 2.0 series. There are far too many changes between 1.x and 2.0 to list, but suffice it to say there have been numerous bug fixes and performance improvements across the board. In particular, there have been substantial improvements to the Streaming mode.

If you were using StreamProvider in past releases, the new approach is to use ClientEngine.AddStreamingAsync which will return a TorrentManager configured for streaming. Once you start the download you can create a stream to any of the files in the torrent using TorrentManager.StreamProvider, just like before.

MonoTorrent now uses an in-memory cache by default, which reduces the number of disk operations substantially. This feature works in tandem with incremental hashing, which means that even if some blocks in a given piece arrive out-of-order, it is still possible to hash all blocks before writing them to disk, eliminating the need to re-read them later.

Finally, the last big features are around how state is saved/restored. FastResume data for a torrent will, by default, be saved every 20-30 seconds. In the event of a crash you will be able to resume the torrent without having to run a complete hash check. This can be controlled by EngineSettings.FastResumeMode if you want to use one of the other behaviours. Additionally, you can serialize a ClientEngine to disk, and restore it, using ClientEngine.SaveStateAsync and the static method ClientEngine.RestoreStateAsync. This should be invoked just before your application closes, or whenever is appropriate. It will flush a fresh copy of fast resume data to disk for all loaded torrent, as well as capturing all mutable state in a TorrentManager so it can be restored later. For example, ITorrentFile.Priority will be maintained, and so will the paths where files are stored if you have used TorrentManager.MoveFileAsync.