Show / Hide Table of Contents

Class EngineSettings

Represents the Settings which need to be passed to the engine

Inheritance
System.Object
EngineSettings
Implements
System.IEquatable<EngineSettings>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: MonoTorrent.Client
Assembly: MonoTorrent.dll
Syntax
public sealed class EngineSettings : IEquatable<EngineSettings>

Constructors

EngineSettings()

Declaration
public EngineSettings()

Properties

AllowedEncryption

A prioritised list of encryption methods, including plain text, which can be used to connect to another peer. Connections will be attempted in the same order as they are in the list. Defaults to MonoTorrent.Client.EncryptionTypes.All, which is RC4Header, RC4Full and PlainText.

Declaration
public IList<EncryptionType> AllowedEncryption { get; }
Property Value
Type Description
System.Collections.Generic.IList<EncryptionType>

AllowHaveSuppression

Have suppression reduces the number of Have messages being sent by only sending Have messages to peers which do not already have that piece. A peer will never request a piece they have already downloaded, so informing them that we have that piece is not beneficial. Defaults to false.

Declaration
public bool AllowHaveSuppression { get; }
Property Value
Type Description
System.Boolean

AllowLocalPeerDiscovery

True if the engine should use LocalPeerDiscovery to search for local peers. Defaults to true.

Declaration
public bool AllowLocalPeerDiscovery { get; }
Property Value
Type Description
System.Boolean

AllowPortForwarding

True if the engine should automatically forward ports using any compatible UPnP or NAT-PMP device. Defaults to true.

Declaration
public bool AllowPortForwarding { get; }
Property Value
Type Description
System.Boolean

AutoSaveLoadDhtCache

If set to true dht nodes will be implicitly saved when there are no active TorrentManager instances in the engine. Dht nodes will be restored when the first TorrentManager is started. Otherwise dht nodes will not be cached between restarts and the DhtEngine will have to bootstrap from scratch each time. Defaults to true.

Declaration
public bool AutoSaveLoadDhtCache { get; }
Property Value
Type Description
System.Boolean

AutoSaveLoadFastResume

If set to true FastResume data will be implicitly saved after StopAsync() is invoked, and will be implicitly loaded before the TorrentManager is returned by AddAsync(MagnetLink, String) Otherwise fast resume data will not be saved or restored and TorrentManager instances will have to perform a full hash check when they start. Defaults to true.

Declaration
public bool AutoSaveLoadFastResume { get; }
Property Value
Type Description
System.Boolean

AutoSaveLoadMagnetLinkMetadata

This setting affects torrents downloaded using a MagnetLink. When enabled, metadata for the torrent will be loaded from MetadataCacheDirectory, if it exists, when the MagnetLink is added to the engine using AddAsync(MagnetLink, String). Additionally, metadata will be written to this directory if it is successfully retrieved from peers so future downloads can start immediately. Defaults to true.

Declaration
public bool AutoSaveLoadMagnetLinkMetadata { get; }
Property Value
Type Description
System.Boolean

CacheDirectory

The full path to the directory used to cache any data needed by the engine. Typically used to store a cache of the DHT table to improve bootstrapping speed, any metadata downloaded using a magnet link, or fast resume data for individual torrents. Defaults to a sub-directory of System.Environment.CurrentDirectory called 'cache'

Declaration
public string CacheDirectory { get; }
Property Value
Type Description
System.String

ConnectionTimeout

If a connection attempt does not complete within the given timeout, it will be cancelled so a connection can be attempted with a new peer. Defaults to 10 seconds. It is highly recommended to keep this value within a range of 7-15 seconds unless absolutely necessary.

Declaration
public TimeSpan ConnectionTimeout { get; }
Property Value
Type Description
System.TimeSpan

DhtPort

The UDP port used for DHT communications. Use 0 to choose a random available port. Choose -1 to disable DHT. Defaults to 0.

Declaration
public int DhtPort { get; }
Property Value
Type Description
System.Int32

DiskCacheBytes

Creates a cache which buffers data before it's written to the disk, or after it's been read from disk. Set to 0 to disable the cache. Defaults to 5MB.

Declaration
public int DiskCacheBytes { get; }
Property Value
Type Description
System.Int32

FastResumeCacheDirectory

This is the full path to a sub-directory of CacheDirectory. If AutoSaveLoadFastResume is enabled then fast resume data will be written to this when StopAsync() or StopAllAsync() is invoked. If fast resume data is available, the data will be loaded from disk as part of AddAsync(MagnetLink, String) or AddStreamingAsync(MagnetLink, String). If StartAsync() is invoked, any on-disk fast resume data will be deleted to eliminate the possibility of loading stale data later.

Declaration
public string FastResumeCacheDirectory { get; }
Property Value
Type Description
System.String

FastResumeMode

When AutoSaveLoadFastResume is true, this setting is used to control how fast resume data is maintained, otherwise it has no effect. You can prioritise accuracy (at the risk of requiring full hash checks if an actively downloading torrent does not cleanly enter the Stopped state) by choosing Accurate. You can prioritise torrent start speed (at the risk of re-downloading a small amount of data) by choosing BestEffort, in which case a recent, not not 100% accurate, copy of the fast resume data will be loaded whenever it is available. if an actively downloading Torrent does not cleanly enter the Stopped state. Defaults to BestEffort.

Declaration
public FastResumeMode FastResumeMode { get; }
Property Value
Type Description
FastResumeMode

ListenPort

The TCP port the engine should listen on for incoming connections. Use 0 to choose a random available port. Choose -1 to disable listening for incoming connections. Defaults to 0.

Declaration
public int ListenPort { get; }
Property Value
Type Description
System.Int32

MaximumConnections

The maximum number of concurrent open connections overall. Defaults to 150.

Declaration
public int MaximumConnections { get; }
Property Value
Type Description
System.Int32

MaximumDiskReadRate

The maximum disk read speed, in bytes per second. A value of 0 means unlimited. This is typically only useful for non-SSD drives to prevent the hashing process from saturating the available drive bandwidth. Defaults to 0.

Declaration
public int MaximumDiskReadRate { get; }
Property Value
Type Description
System.Int32

MaximumDiskWriteRate

The maximum disk write speed, in bytes per second. A value of 0 means unlimited. This is typically only useful for non-SSD drives to prevent the downloading process from saturating the available drive bandwidth. If the download speed exceeds the max write rate then the download will be throttled. Defaults to 0.

Declaration
public int MaximumDiskWriteRate { get; }
Property Value
Type Description
System.Int32

MaximumDownloadSpeed

The maximum download speed, in bytes per second, overall. A value of 0 means unlimited. Defaults to 0.

Declaration
public int MaximumDownloadSpeed { get; }
Property Value
Type Description
System.Int32

MaximumHalfOpenConnections

The maximum number of concurrent connection attempts overall. Defaults to 8.

Declaration
public int MaximumHalfOpenConnections { get; }
Property Value
Type Description
System.Int32

MaximumOpenFiles

The maximum number of files which can be opened concurrently. On platforms which limit the maximum filehandles for a process it can be beneficial to limit the number of open files to prevent running out of resources. A value of 0 means unlimited, but this is not recommended. Defaults to 196.

Declaration
public int MaximumOpenFiles { get; }
Property Value
Type Description
System.Int32

MaximumUploadSpeed

The maximum upload speed, in bytes per second, overall. A value of 0 means unlimited. defaults to 0.

Declaration
public int MaximumUploadSpeed { get; }
Property Value
Type Description
System.Int32

MetadataCacheDirectory

This is the full path to a sub-directory of CacheDirectory. If a magnet link is used to download a torrent, the downloaded metata will be cached here.

Declaration
public string MetadataCacheDirectory { get; }
Property Value
Type Description
System.String

ReportedAddress

If the IPAddress incoming peer connections are received on differs from the IPAddress the tracker Announce or Scrape requests are sent from, specify it here. Typically this should not be set. Defaults to null

Declaration
public IPEndPoint ReportedAddress { get; }
Property Value
Type Description
System.Net.IPEndPoint

Methods

Equals(EngineSettings)

Declaration
public bool Equals(EngineSettings other)
Parameters
Type Name Description
EngineSettings other
Returns
Type Description
System.Boolean

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.Object.Equals(System.Object)

GetFastResumePath(InfoHash)

Returns the full path to the FastResume file for the specified torrent. This is where data will be written to, or loaded from, when AutoSaveLoadFastResume is enabled.

Declaration
public string GetFastResumePath(InfoHash infoHash)
Parameters
Type Name Description
InfoHash infoHash

The infohash of the torrent

Returns
Type Description
System.String

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()

Implements

System.IEquatable<T>
In This Article
Back to top Generated by DocFX