| libtorrent

Author: | Arvid Norberg, arvid@libtorrent.org
Version: | 1.1.13

home

# Settings

Table of contents

- Settings
  - dht_settings
  - settings_pack
  - min_memory_usage() high_performance_seed()
  - setting_by_name() name_for_setting()
  - default_settings()

You have some control over session configuration through the session::apply_settings() member function. To change one or more configuration options, create a settings_pack object and fill it with the settings to be set and pass it in to session::apply_settings().

The settings_pack object is a collection of settings updates that are applied to the session when passed to session::apply_settings(). It's empty when constructed.

You have control over proxy and authorization settings and also the user-agent that will be sent to the tracker. The user-agent will also be used to identify the client with other peers.

## dht_settings

Declared in "libtorrent/session_settings.hpp"

structure used to hold configuration options for the DHT

The `dht_settings` struct used to contain a `service_port` member to control which port the DHT would listen on and send messages from. This field is deprecated and ignored. libtorrent always tries to open the UDP socket on the same port as the TCP socket.

    struct dht_settings
    {
       dht_settings ();

       int max_peers_reply;
       int search_branching;
       int max_fail_count;
       int max_torrents;
       int max_dht_items;
       int max_peers;
       int max_torrent_search_reply;
       bool restrict_routing_ips;
       bool restrict_search_ips;
       bool extended_routing_table;
       bool aggressive_lookups;
       bool privacy_lookups;
       bool enforce_node_id;
       bool ignore_dark_internet;
       int block_timeout;
       int block_ratelimit;
       bool read_only;
       int item_lifetime;
    };

### dht_settings()

    dht_settings ();

initialized dht_settings to the default values

max_peers_reply
  the maximum number of peers to send in a reply to `get_peers`

search_branching
  the number of concurrent search request the node will send when announcing and refreshing the routing table. This parameter is called alpha in the kademlia paper

max_fail_count
  the maximum number of failed tries to contact a node before it is removed from the routing table. If there are known working nodes that are ready to replace a failing node, it will be replaced immediately, this limit is only used to clear out nodes that don't have any node that can replace them.

max_torrents
  the total number of torrents to track from the DHT. This is simply an upper limit to make sure malicious DHT nodes cannot make us allocate an unbounded amount of memory.

max_dht_items
  max number of items the DHT will store

max_peers
  the max number of peers to store per torrent (for the DHT)

max_torrent_search_reply
  the max number of torrents to return in a torrent search query to the DHT

restrict_routing_ips

  determines if the routing table entries should restrict entries to one per IP. This defaults to true, which helps mitigate some attacks on the DHT. It prevents adding multiple nodes with IPs with a very close CIDR distance.

  when set, nodes whose IP address that's in the same /24 (or /64 for IPv6) range in the same routing table bucket. This is an attempt to mitigate node ID spoofing attacks also restrict any IP to only have a single entry in the whole routing table

restrict_search_ips
  determines if DHT searches should prevent adding nodes with IPs with very close CIDR distance. This also defaults to true and helps mitigate certain attacks on the DHT.

extended_routing_table
  makes the first buckets in the DHT routing table fit 128, 64, 32 and 16 nodes respectively, as opposed to the standard size of 8. All other buckets have size 8 still.

aggressive_lookups
  slightly changes the lookup behavior in terms of how many outstanding requests we keep. Instead of having branch factor be a hard limit, we always keep branch factor outstanding requests to the closest nodes. i.e. every time we get results back with closer nodes, we query them right away. It lowers the lookup times at the cost of more outstanding queries.

privacy_lookups
  when set, perform lookups in a way that is slightly more expensive, but which minimizes the amount of information leaked about you.

enforce_node_id
  when set, node's whose IDs that are not correctly generated based on its external IP are ignored. When a query arrives from such node, an error message is returned with a message saying "invalid node ID".

ignore_dark_internet
  ignore DHT messages from parts of the internet we wouldn't expect to see any traffic from

block_timeout
  the number of seconds a DHT node is banned if it exceeds the rate limit. The rate limit is averaged over 10 seconds to allow for bursts above the limit.

block_ratelimit
  the max number of packets per second a DHT node is allowed to send without getting banned.

read_only
  when set, the other nodes won't keep this node in their routing tables, it's meant for low-power and/or ephemeral devices that cannot support the DHT, it is also useful for mobile devices which are sensitive to network traffic and battery life. this node no longer responds to 'query' messages, and will place a 'ro' key (value = 1) in the top-level message dictionary of outgoing query messages.

item_lifetime
  the number of seconds a immutable/mutable item will be expired. default is 0, means never expires.

## settings_pack

Declared in "libtorrent/settings_pack.hpp"

The `settings_pack` struct, contains the names of all settings as enum values. These values are passed in to the `set_str()`, `set_int()`, `set_bool()` functions, to specify the setting to change.

These are the available settings:

name | type | default
--- | --- | ---
user_agent | string | "libtorrent/" LIBTORRENT_VERSION

this is the client identification to the tracker. The recommended format of this string is: "ClientName/ClientVersion libtorrent/libtorrentVersion". This name will not only be used when making HTTP requests, but also when sending extended headers to peers that support that extension. It may not contain r or n

name | type | default
--- | --- | ---
announce_ip | string | 0

`announce_ip` is the ip address passed along to trackers as the `&ip=` parameter. If left as the default, that parameter is omitted.

name | type | default
--- | --- | ---
handshake_client_version | string | 0

this is the client name and version identifier sent to peers in the handshake message. If this is an empty string, the user_agent is used instead

name | type | default
--- | --- | ---
outgoing_interfaces | string | ""

sets the network interface this session will use when it opens outgoing connections. By default, it binds outgoing connections to INADDR_ANY and port 0 (i.e. let the OS decide). Ths parameter must be a string containing one or more, comma separated, adapter names. Adapter names on unix systems are of the form "eth0", "eth1", "tun0", etc. When specifying multiple interfaces, they will be assigned in round-robin order. This may be useful for clients that are multi-homed. Binding an outgoing connection to a local IP does not necessarily make the connection via the associated NIC/Adapter. Setting this to an empty string will disable binding of outgoing connections.

name | type | default
--- | --- | ---
listen_interfaces | string | "0.0.0.0:6881"

a comma-separated list of IP port-pairs. These are the listen ports that will be opened for accepting incoming uTP and TCP connections. It is possible to listen on multiple IPs and multiple ports. Binding to port 0 will make the operating system pick the port. The default is "0.0.0.0:6881", which binds to all interfaces on port 6881.

If binding fails because the port is busy, the port number will be incremented by one, `settings_pack::max_retry_port_bind` times.

if all retry attempts fail, the socket will be bound to port 0, meaning the operating system will pick a port. This behavior can be disabled by disabling `settings_pack::listen_system_port_fallback`.

if binding fails, the listen_failed_alert is posted, potentially more than once. Once/if binding the listen socket(s) succeed, listen_succeeded_alert is posted.

Each port will attempt to open both a UDP and a TCP listen socket, to allow accepting uTP connections as well as TCP. If using the DHT, this will also make the DHT use the same UDP ports.

Note

The current support for opening arbitrary UDP sockets is limited. In this version of libtorrent, there will only ever be two UDP sockets, one for IPv4 and one for IPv6.

name | type | default
--- | --- | ---
proxy_hostname | string | ""

when using a poxy, this is the hostname where the proxy is running see proxy_type.

name | type | default
--- | --- | ---
proxy_username | string | ""
proxy_password | string | ""

when using a proxy, these are the credentials (if any) to use whne connecting to it. see proxy_type

name | type | default
--- | --- | ---
i2p_hostname | string | ""

sets the i2p SAM bridge to connect to. set the port with the `i2p_port` setting.

name | type | default
--- | --- | ---
peer_fingerprint | string | "-LT11D0-"

this is the fingerprint for the client. It will be used as the prefix to the peer_id. If this is 20 bytes (or longer) it will be truncated to 20 bytes and used as the entire peer-id

There is a utility function, generate_fingerprint() that can be used to generate a standard client peer ID fingerprint prefix.

name | type | default
--- | --- | ---
dht_bootstrap_nodes | string | "dht.libtorrent.org:25401"

This is a comma-separated list of IP port-pairs. They will be added to the DHT node (if it's enabled) as back-up nodes in case we don't know of any. This setting will contain one or more bootstrap nodes by default.

Changing these after the DHT has been started may not have any effect until the DHT is restarted.

name | type | default
--- | --- | ---
allow_multiple_connections_per_ip | bool | false

determines if connections from the same IP address as existing connections should be rejected or not. Multiple connections from the same IP address is not allowed by default, to prevent abusive behavior by peers. It may be useful to allow such connections in cases where simulations are run on the same machine, and all peers in a swarm has the same IP address.

name | type | default
--- | --- | ---
send_redundant_have | bool | true

`send_redundant_have` controls if have messages will be sent to peers that already have the piece. This is typically not necessary, but it might be necessary for collecting statistics in some cases. Default is false.

name | type | default
--- | --- | ---
lazy_bitfields | bool | false

if this is true, outgoing bitfields will never be fuil. If the client is seed, a few bits will be set to 0, and later filled in with have messages. This is to prevent certain ISPs from stopping people from seeding.

name | type | default
--- | --- | ---
use_dht_as_fallback | bool | false

`use_dht_as_fallback` determines how the DHT is used. If this is true, the DHT will only be used for torrents where all trackers in its tracker list has failed. Either by an explicit error message or a time out. This is false by default, which means the DHT is used by default regardless of if the trackers fail or not.

name | type | default
--- | --- | ---
upnp_ignore_nonrouters | bool | false

`upnp_ignore_nonrouters` indicates whether or not the UPnP implementation should ignore any broadcast response from a device whose address is not the configured router for this machine. i.e. it's a way to not talk to other people's routers by mistake.

name | type | default
--- | --- | ---
use_parole_mode | bool | true

`use_parole_mode` specifies if parole mode should be used. Parole mode means that peers that participate in pieces that fail the hash check are put in a mode where they are only allowed to download whole pieces. If the whole piece a peer in parole mode fails the hash check, it is banned. If a peer participates in a piece that passes the hash check, it is taken out of parole mode.

name | type | default
--- | --- | ---
use_read_cache | bool | true

enable and disable caching of blocks read from disk. the purpose of the read cache is partly read-ahead of requests but also to avoid reading blocks back from the disk multiple times for popular pieces.

name | type | default
--- | --- | ---
coalesce_reads | bool | false
coalesce_writes | bool | false

allocate separate, contiguous, buffers for read and write calls. Only used where writev/readv cannot be used will use more RAM but may improve performance

name | type | default
--- | --- | ---
auto_manage_prefer_seeds | bool | false

prefer seeding torrents when determining which torrents to give active slots to, the default is false which gives preference to downloading torrents

name | type | default
--- | --- | ---
dont_count_slow_torrents | bool | true

if `dont_count_slow_torrents` is true, torrents without any payload transfers are not subject to the `active_seeds` and `active_downloads` limits. This is intended to make it more likely to utilize all available bandwidth, and avoid having torrents that don't transfer anything block the active slots.

name | type | default
--- | --- | ---
close_redundant_connections | bool | true

`close_redundant_connections` specifies whether libtorrent should close connections where both ends have no utility in keeping the connection open. For instance if both ends have completed their downloads, there's no point in keeping it open.

name | type | default
--- | --- | ---
prioritize_partial_pieces | bool | false

If `prioritize_partial_pieces` is true, partial pieces are picked before pieces that are more rare. If false, rare pieces are always prioritized, unless the number of partial pieces is growing out of proportion.

name | type | default
--- | --- | ---
rate_limit_ip_overhead | bool | true

if set to true, the estimated TCP/IP overhead is drained from the rate limiters, to avoid exceeding the limits with the total traffic

name | type | default
--- | --- | ---
announce_to_all_tiers | bool | false
announce_to_all_trackers | bool | false

`announce_to_all_trackers` controls how multi tracker torrents are treated. If this is set to true, all trackers in the same tier are announced to in parallel. If all trackers in tier 0 fails, all trackers in tier 1 are announced as well. If it's set to false, the behavior is as defined by the multi tracker specification. It defaults to false, which is the same behavior previous versions of libtorrent has had as well.

`announce_to_all_tiers` also controls how multi tracker torrents are treated. When this is set to true, one tracker from each tier is announced to. This is the uTorrent behavior. This is false by default in order to comply with the multi-tracker specification.

name | type | default
--- | --- | ---
prefer_udp_trackers | bool | true

`prefer_udp_trackers` is true by default. It means that trackers may be rearranged in a way that udp trackers are always tried before http trackers for the same hostname. Setting this to false means that the trackers' tier is respected and there's no preference of one protocol over another.

name | type | default
--- | --- | ---
strict_super_seeding | bool | false

`strict_super_seeding` when this is set to true, a piece has to have been forwarded to a third peer before another one is handed out. This is the traditional definition of super seeding.

name | type | default
--- | --- | ---
disable_hash_checks | bool | false

when set to true, all data downloaded from peers will be assumed to be correct, and not tested to match the hashes in the torrent this is only useful for simulation and testing purposes (typically combined with disabled_storage)

name | type | default
--- | --- | ---
allow_i2p_mixed | bool | false

if this is true, i2p torrents are allowed to also get peers from other sources than the tracker, and connect to regular IPs, not providing any anonymization. This may be useful if the user is not interested in the anonymization of i2p, but still wants to be able to connect to i2p peers.

name | type | default
--- | --- | ---
low_prio_disk | bool | true

`low_prio_disk` determines if the disk I/O should use a normal or low priority policy. This defaults to true, which means that it's low priority by default. Other processes doing disk I/O will normally take priority in this mode. This is meant to improve the overall responsiveness of the system while downloading in the background. For high-performance server setups, this might not be desirable.

name | type | default
--- | --- | ---
volatile_read_cache | bool | false

`volatile_read_cache`, if this is set to true, read cache blocks that are hit by peer read requests are removed from the disk cache to free up more space. This is useful if you don't expect the disk cache to create any cache hits from other peers than the one who triggered the cache line to be read into the cache in the first place.

name | type | default
--- | --- | ---
guided_read_cache | bool | false

`guided_read_cache` enables the disk cache to adjust the size of a cache line generated by peers to depend on the upload rate you are sending to that peer. The intention is to optimize the RAM usage of the cache, to read ahead further for peers that you're sending faster to.

name | type | default
--- | --- | ---
no_atime_storage | bool | true

`no_atime_storage` this is a linux-only option and passes in the `O_NOATIME` to `open()` when opening files. This may lead to some disk performance improvements.

name | type | default
--- | --- | ---
incoming_starts_queued_torrents | bool | false

`incoming_starts_queued_torrents` defaults to false. If a torrent has been paused by the auto managed feature in libtorrent, i.e. the torrent is paused and auto managed, this feature affects whether or not it is automatically started on an incoming connection. The main reason to queue torrents, is not to make them unavailable, but to save on the overhead of announcing to the trackers, the DHT and to avoid spreading one's unchoke slots too thin. If a peer managed to find us, even though we're no in the torrent anymore, this setting can make us start the torrent and serve it.

name | type | default
--- | --- | ---
report_true_downloaded | bool | false

when set to true, the downloaded counter sent to trackers will include the actual number of payload bytes downloaded including redundant bytes. If set to false, it will not include any redundancy bytes

name | type | default
--- | --- | ---
strict_end_game_mode | bool | true

`strict_end_game_mode` defaults to true, and controls when a block may be requested twice. If this is `true`, a block may only be requested twice when there's ay least one request to every piece that's left to download in the torrent. This may slow down progress on some pieces sometimes, but it may also avoid downloading a lot of redundant bytes. If this is `false`, libtorrent attempts to use each peer connection to its max, by always requesting something, even if it means requesting something that has been requested from another peer already.

name | type | default
--- | --- | ---
broadcast_lsd | bool | true

if `broadcast_lsd` is set to true, the local peer discovery (or Local Service Discovery) will not only use IP multicast, but also broadcast its messages. This can be useful when running on networks that don't support multicast. Since broadcast messages might be expensive and disruptive on networks, only every 8th announce uses broadcast.

name | type | default
--- | --- | ---
enable_outgoing_utp | bool | true
enable_incoming_utp | bool | true
enable_outgoing_tcp | bool | true
enable_incoming_tcp | bool | true

when set to true, libtorrent will try to make outgoing utp connections controls whether libtorrent will accept incoming connections or make outgoing connections of specific type.

name | type | default
--- | --- | ---
ignore_resume_timestamps | bool | false

`ignore_resume_timestamps` determines if the storage, when loading resume data files, should verify that the file modification time with the timestamps in the resume data. This defaults to false, which means timestamps are taken into account, and resume data is less likely to accepted (torrents are more likely to be fully checked when loaded). It might be useful to set this to true if your network is faster than your disk, and it would be faster to redownload potentially missed pieces than to go through the whole storage to look for them.

name | type | default
--- | --- | ---
no_recheck_incomplete_resume | bool | false

`no_recheck_incomplete_resume` determines if the storage should check the whole files when resume data is incomplete or missing or whether it should simply assume we don't have any of the data. By default, this is determined by the existence of any of the files. By setting this setting to true, the files won't be checked, but will go straight to download mode.

name | type | default
--- | --- | ---
anonymous_mode | bool | false

`anonymous_mode` defaults to false. When set to true, the client tries to hide its identity to a certain degree. The user-agent will be reset to an empty string (except for private torrents). Trackers will only be used if they are using a proxy server. The listen sockets are closed, and incoming connections will only be accepted through a SOCKS5 or I2P proxy (if a peer proxy is set up and is run on the same machine as the tracker proxy). Since no incoming connections are accepted, NAT-PMP, UPnP, DHT and local peer discovery are all turned off when this setting is enabled.

If you're using I2P, it might make sense to enable anonymous mode as well.

name | type | default
--- | --- | ---
report_web_seed_downloads | bool | true

specifies whether downloads from web seeds is reported to the tracker or not. Defaults to on. Turning it off also excludes web seed traffic from other stats and download rate reporting via the libtorrent API.

name | type | default
--- | --- | ---
announce_double_nat | bool | false

if this is true, the `&ip=` argument in tracker requests (unless otherwise specified) will be set to the intermediate IP address if the user is double NATed. If the user is not double NATed, this option does not have an affect

name | type | default
--- | --- | ---
seeding_outgoing_connections | bool | true

`seeding_outgoing_connections` determines if seeding (and finished) torrents should attempt to make outgoing connections or not. By default this is true. It may be set to false in very specific applications where the cost of making outgoing connections is high, and there are no or small benefits of doing so. For instance, if no nodes are behind a firewall or a NAT, seeds don't need to make outgoing connections.

name | type | default
--- | --- | ---
no_connect_privileged_ports | bool | false

when this is true, libtorrent will not attempt to make outgoing connections to peers whose port is < 1024. This is a safety precaution to avoid being part of a DDoS attack

name | type | default
--- | --- | ---
smooth_connects | bool | true

`smooth_connects` is true by default, which means the number of connection attempts per second may be limited to below the `connection_speed`, in case we're close to bump up against the limit of number of connections. The intention of this setting is to more evenly distribute our connection attempts over time, instead of attempting to connect in batches, and timing them out in batches.

name | type | default
--- | --- | ---
always_send_user_agent | bool | false

always send user-agent in every web seed request. If false, only the first request per http connection will include the user agent

name | type | default
--- | --- | ---
apply_ip_filter_to_trackers | bool | true

`apply_ip_filter_to_trackers` defaults to true. It determines whether the IP filter applies to trackers as well as peers. If this is set to false, trackers are exempt from the IP filter (if there is one). If no IP filter is set, this setting is irrelevant.

name | type | default
--- | --- | ---
use_disk_read_ahead | bool | true

`use_disk_read_ahead` defaults to true and will attempt to optimize disk reads by giving the operating system heads up of disk read requests as they are queued in the disk job queue.

name | type | default
--- | --- | ---
lock_files | bool | false

`lock_files` determines whether or not to lock files which libtorrent is downloading to or seeding from. This is implemented using `fcntl(F_SETLK)` on unix systems and by not passing in `SHARE_READ` and `SHARE_WRITE` on windows. This might prevent 3rd party processes from corrupting the files under libtorrent's feet.

name | type | default
--- | --- | ---
contiguous_recv_buffer | bool | true

`contiguous_recv_buffer` determines whether or not libtorrent should receive data from peers into a contiguous intermediate buffer, to then copy blocks into disk buffers from, or to make many smaller calls to `read()`, each time passing in the specific buffer the data belongs in. When downloading at high rates, the latter may save some time copying data. When seeding at high rates, all incoming traffic consists of a very large number of tiny packets, and enabling `contiguous_recv_buffer` will provide higher performance. When this is enabled, it will only be used when seeding to peers, since that's when it provides performance improvements.

name | type | default
--- | --- | ---
ban_web_seeds | bool | true

when true, web seeds sending bad data will be banned

name | type | default
--- | --- | ---
allow_partial_disk_writes | bool | true

when set to false, the `write_cache_line_size` will apply across piece boundaries. this is a bad idea unless the piece picker also is configured to have an affinity to pick pieces belonging to the same write cache line as is configured in the disk cache.

name | type | default
--- | --- | ---
force_proxy | bool | false

If true, disables any communication that's not going over a proxy. Enabling this requires a proxy to be configured as well, see proxy_type and proxy_hostname settings. The listen sockets are closed, and incoming connections will only be accepted through a SOCKS5 or I2P proxy (if a peer proxy is set up and is run on the same machine as the tracker proxy).

name | type | default
--- | --- | ---
support_share_mode | bool | true

if false, prevents libtorrent to advertise share-mode support

name | type | default
--- | --- | ---
support_merkle_torrents | bool | true

if this is false, don't advertise support for the Tribler merkle tree piece message

name | type | default
--- | --- | ---
report_redundant_bytes | bool | true

if this is true, the number of redundant bytes is sent to the tracker

name | type | default
--- | --- | ---
listen_system_port_fallback | bool | true

if this is true, libtorrent will fall back to listening on a port chosen by the operating system (i.e. binding to port 0). If a failure is preferred, set this to false.

name | type | default
--- | --- | ---
use_disk_cache_pool | bool | false

`use_disk_cache_pool` enables using a pool allocator for disk cache blocks. Enabling it makes the cache perform better at high throughput. It also makes the cache less likely and slower at returning memory back to the system, once allocated.

name | type | default
--- | --- | ---
announce_crypto_support | bool | true

when this is true, and incoming encrypted connections are enabled, &supportcrypt=1 is included in http tracker announces

name | type | default
--- | --- | ---
enable_upnp | bool | true

Starts and stops the UPnP service. When started, the listen port and the DHT port are attempted to be forwarded on local UPnP router devices.

The upnp object returned by `start_upnp()` can be used to add and remove arbitrary port mappings. Mapping status is returned through the portmap_alert and the portmap_error_alert. The object will be valid until `stop_upnp()` is called. See upnp and nat pmp.

name | type | default
--- | --- | ---
enable_natpmp | bool | true

Starts and stops the NAT-PMP service. When started, the listen port and the DHT port are attempted to be forwarded on the router through NAT-PMP.

The natpmp object returned by `start_natpmp()` can be used to add and remove arbitrary port mappings. Mapping status is returned through the portmap_alert and the portmap_error_alert. The object will be valid until `stop_natpmp()` is called. See upnp and nat pmp.

name | type | default
--- | --- | ---
enable_lsd | bool | true

Starts and stops Local Service Discovery. This service will broadcast the infohashes of all the non-private torrents on the local network to look for peers on the same swarm within multicast reach.

name | type | default
--- | --- | ---
enable_dht | bool | true

starts the dht node and makes the trackerless service available to torrents.

name | type | default
--- | --- | ---
prefer_rc4 | bool | false

if the allowed encryption level is both, setting this to true will prefer rc4 if both methods are offered, plaintext otherwise

name | type | default
--- | --- | ---
proxy_hostnames | bool | true

if true, hostname lookups are done via the configured proxy (if any). This is only supported by SOCKS5 and HTTP.

name | type | default
--- | --- | ---
proxy_peer_connections | bool | true

if true, peer connections are made (and accepted) over the configured proxy, if any. Web seeds as well as regular bittorrent peer connections are considered "peer connections". Anything transporting actual torrent payload (trackers and DHT traffic are not considered peer connections).

name | type | default
--- | --- | ---
auto_sequential | bool | true

if this setting is true, torrents with a very high availability of pieces (and seeds) are downloaded sequentially. This is more efficient for the disk I/O. With many seeds, the download order is unlikely to matter anyway

name | type | default
--- | --- | ---
proxy_tracker_connections | bool | true

if true, tracker connections are made over the configured proxy, if any.

name | type | default
--- | --- | ---
tracker_completion_timeout | int | 30

`tracker_completion_timeout` is the number of seconds the tracker connection will wait from when it sent the request until it considers the tracker to have timed-out. Default value is 60 seconds.

name | type | default
--- | --- | ---
tracker_receive_timeout | int | 10

`tracker_receive_timeout` is the number of seconds to wait to receive any data from the tracker. If no data is received for this number of seconds, the tracker will be considered as having timed out. If a tracker is down, this is the kind of timeout that will occur.

name | type | default
--- | --- | ---
stop_tracker_timeout | int | 5

the time to wait when sending a stopped message before considering a tracker to have timed out. this is usually shorter, to make the client quit faster

name | type | default
--- | --- | ---
tracker_maximum_response_length | int | 1024*1024

this is the maximum number of bytes in a tracker response. If a response size passes this number of bytes it will be rejected and the connection will be closed. On gzipped responses this size is measured on the uncompressed data. So, if you get 20 bytes of gzip response that'll expand to 2 megabytes, it will be interrupted before the entire response has been uncompressed (assuming the limit is lower than 2 megs).

name | type | default
--- | --- | ---
piece_timeout | int | 20

the number of seconds from a request is sent until it times out if no piece response is returned.

name | type | default
--- | --- | ---
request_timeout | int | 60

the number of seconds one block (16kB) is expected to be received within. If it's not, the block is requested from a different peer

name | type | default
--- | --- | ---
request_queue_time | int | 3

the length of the request queue given in the number of seconds it should take for the other end to send all the pieces. i.e. the actual number of requests depends on the download rate and this number.

name | type | default
--- | --- | ---
max_allowed_in_request_queue | int | 500

the number of outstanding block requests a peer is allowed to queue up in the client. If a peer sends more requests than this (before the first one has been sent) the last request will be dropped. the higher this is, the faster upload speeds the client can get to a single peer.

name | type | default
--- | --- | ---
max_out_request_queue | int | 500

`max_out_request_queue` is the maximum number of outstanding requests to send to a peer. This limit takes precedence over `request_queue_time`. i.e. no matter the download speed, the number of outstanding requests will never exceed this limit.

name | type | default
--- | --- | ---
whole_pieces_threshold | int | 20

if a whole piece can be downloaded in this number of seconds, or less, the peer_connection will prefer to request whole pieces at a time from this peer. The benefit of this is to better utilize disk caches by doing localized accesses and also to make it easier to identify bad peers if a piece fails the hash check.

name | type | default
--- | --- | ---
peer_timeout | int | 120

`peer_timeout` is the number of seconds the peer connection should wait (for any activity on the peer connection) before closing it due to time out. This defaults to 120 seconds, since that's what's specified in the protocol specification. After half the time out, a keep alive message is sent.

name | type | default
--- | --- | ---
urlseed_timeout | int | 20

same as peer_timeout, but only applies to url-seeds. this is usually set lower, because web servers are expected to be more reliable.

name | type | default
--- | --- | ---
urlseed_pipeline_size | int | 5

controls the pipelining size of url-seeds. i.e. the number of HTTP request to keep outstanding before waiting for the first one to complete. It's common for web servers to limit this to a relatively low number, like 5

name | type | default
--- | --- | ---
urlseed_wait_retry | int | 30

time to wait until a new retry of a web seed takes place

name | type | default
--- | --- | ---
file_pool_size | int | 40

sets the upper limit on the total number of files this session will keep open. The reason why files are left open at all is that some anti virus software hooks on every file close, and scans the file for viruses. deferring the closing of the files will be the difference between a usable system and a completely hogged down system. Most operating systems also has a limit on the total number of file descriptors a process may have open.

name | type | default
--- | --- | ---
max_failcount | int | 3

`max_failcount` is the maximum times we try to connect to a peer before stop connecting again. If a peer succeeds, the failcounter is reset. If a peer is retrieved from a peer source (other than DHT) the failcount is decremented by one, allowing another try.

name | type | default
--- | --- | ---
min_reconnect_time | int | 60

the number of seconds to wait to reconnect to a peer. this time is multiplied with the failcount.

name | type | default
--- | --- | ---
peer_connect_timeout | int | 15

`peer_connect_timeout` the number of seconds to wait after a connection attempt is initiated to a peer until it is considered as having timed out. This setting is especially important in case the number of half-open connections are limited, since stale half-open connection may delay the connection of other peers considerably.

name | type | default
--- | --- | ---
connection_speed | int | 30

`connection_speed` is the number of connection attempts that are made per second. If a number < 0 is specified, it will default to 200 connections per second. If 0 is specified, it means don't make outgoing connections at all.

name | type | default
--- | --- | ---
inactivity_timeout | int | 600

if a peer is uninteresting and uninterested for longer than this number of seconds, it will be disconnected. default is 10 minutes

name | type | default
--- | --- | ---
unchoke_interval | int | 15

`unchoke_interval` is the number of seconds between chokes/unchokes. On this interval, peers are re-evaluated for being choked/unchoked. This is defined as 30 seconds in the protocol, and it should be significantly longer than what it takes for TCP to ramp up to it's max rate.

name | type | default
--- | --- | ---
optimistic_unchoke_interval | int | 30

`optimistic_unchoke_interval` is the number of seconds between each optimistic unchoke. On this timer, the currently optimistically unchoked peer will change.

name | type | default
--- | --- | ---
num_want | int | 200

`num_want` is the number of peers we want from each tracker request. It defines what is sent as the `&num_want=` parameter to the tracker.

name | type | default
--- | --- | ---
initial_picker_threshold | int | 4

`initial_picker_threshold` specifies the number of pieces we need before we switch to rarest first picking. This defaults to 4, which means the 4 first pieces in any torrent are picked at random, the following pieces are picked in rarest first order.

name | type | default
--- | --- | ---
allowed_fast_set_size | int | 10

the number of allowed pieces to send to peers that supports the fast extensions

name | type | default
--- | --- | ---
suggest_mode | int | settings_pack::no_piece_suggestions

`suggest_mode` controls whether or not libtorrent will send out suggest messages to create a bias of its peers to request certain pieces. The modes are:

- `no_piece_suggestions` which is the default and will not send out suggest messages.
- `suggest_read_cache` which will send out suggest messages for the most recent pieces that are in the read cache.

name | type | default
--- | --- | ---
max_queued_disk_bytes | int | 1024 * 1024

`max_queued_disk_bytes` is the maximum number of bytes, to be written to disk, that can wait in the disk I/O thread queue. This queue is only for waiting for the disk I/O thread to receive the job and either write it to disk or insert it in the write cache. When this limit is reached, the peer connections will stop reading data from their sockets, until the disk thread catches up. Setting this too low will severely limit your download rate.

name | type | default
--- | --- | ---
handshake_timeout | int | 10

the number of seconds to wait for a handshake response from a peer. If no response is received within this time, the peer is disconnected.

name | type | default
--- | --- | ---
send_buffer_low_watermark | int | 10 * 1024
send_buffer_watermark | int | 500 * 1024
send_buffer_watermark_factor | int | 50

`send_buffer_low_watermark` the minimum send buffer target size (send buffer includes bytes pending being read from disk). For good and snappy seeding performance, set this fairly high, to at least fit a few blocks. This is essentially the initial window size which will determine how fast we can ramp up the send rate

if the send buffer has fewer bytes than `send_buffer_watermark`, we'll read another 16kB block onto it. If set too small, upload rate capacity will suffer. If set too high, memory will be wasted. The actual watermark may be lower than this in case the upload rate is low, this is the upper limit.

the current upload rate to a peer is multiplied by this factor to get the send buffer watermark. The factor is specified as a percentage. i.e. 50 -> 0.5 This product is clamped to the `send_buffer_watermark` setting to not exceed the max. For high speed upload, this should be set to a greater value than 100. For high capacity connections, setting this higher can improve upload performance and disk throughput. Setting it too high may waste RAM and create a bias towards read jobs over write jobs.

name | type | default
--- | --- | ---
choking_algorithm | int | settings_pack::fixed_slots_choker
seed_choking_algorithm | int | settings_pack::round_robin

`choking_algorithm` specifies which algorithm to use to determine which peers to unchoke.

The options for choking algorithms are:

- `fixed_slots_choker` is the traditional choker with a fixed number of unchoke slots (as specified by `settings_pack::unchoke_slots_limit`).
- `rate_based_choker` opens up unchoke slots based on the upload rate achieved to peers. The more slots that are opened, the marginal upload rate required to open up another slot increases.
- `bittyrant_choker` attempts to optimize download rate by finding the reciprocation rate of each peer individually and prefers peers that gives the highest return on investment. It still allocates all upload capacity, but shuffles it around to the best peers first. For this choker to be efficient, you need to set a global upload rate limit (`settings_pack::upload_rate_limit`). For more information about this choker, see the paper. This choker is not fully implemented nor tested.

`seed_choking_algorithm` controls the seeding unchoke behavior. The available options are:

- `round_robin` which round-robins the peers that are unchoked when seeding. This distributes the upload bandwidht uniformly and fairly. It minimizes the ability for a peer to download everything without redistributing it.
- `fastest_upload` unchokes the peers we can send to the fastest. This might be a bit more reliable in utilizing all available capacity.
- `anti_leech` prioritizes peers who have just started or are just about to finish the download. The intention is to force peers in the middle of the download to trade with each other.

name | type | default
--- | --- | ---
cache_size | int | 1024
cache_buffer_chunk_size | int | 0
cache_expiry | int | 300

`cache_size` is the disk write and read cache. It is specified in units of 16 KiB blocks. Buffers that are part of a peer's send or receive buffer also count against this limit. Send and receive buffers will never be denied to be allocated, but they will cause the actual cached blocks to be flushed or evicted. If this is set to -1, the cache size is automatically set to the amount of physical RAM available in the machine divided by 8. If the amount of physical RAM cannot be determined, it's set to 1024 (= 16 MiB).

Disk buffers are allocated using a pool allocator, the number of blocks that are allocated at a time when the pool needs to grow can be specified in `cache_buffer_chunk_size`. Lower numbers saves memory at the expense of more heap allocations. If it is set to 0, the effective chunk size is proportional to the total cache size, attempting to strike a good balance between performance and memory usage. It defaults to 0. `cache_expiry` is the number of seconds from the last cached write to a piece in the write cache, to when it's forcefully flushed to disk. Default is 60 second.

On 32 bit builds, the effective cache size will be limited to 3/4 of 2 GiB to avoid exceeding the virtual address space limit.

name | type | default
--- | --- | ---
disk_io_write_mode | int | settings_pack::enable_os_cache
disk_io_read_mode | int | settings_pack::enable_os_cache

determines how files are opened when they're in read only mode versus read and write mode. The options are:

enable_os_cache
  This is the default and files are opened normally, with the OS caching reads and writes.
disable_os_cache
  This opens all files in no-cache mode. This corresponds to the OS not letting blocks for the files linger in the cache. This makes sense in order to avoid the bittorrent client to potentially evict all other processes' cache by simply handling high throughput and large files. If libtorrent's read cache is disabled, enabling this may reduce performance.

One reason to disable caching is that it may help the operating system from growing its file cache indefinitely.

name | type | default
--- | --- | ---
outgoing_port | int | 0
num_outgoing_ports | int | 0

this is the first port to use for binding outgoing connections to. This is useful for users that have routers that allow QoS settings based on local port. when binding outgoing connections to specific ports, `num_outgoing_ports` is the size of the range. It should be more than a few

Warning

setting outgoing ports will limit the ability to keep multiple connections to the same client, even for different torrents. It is not recommended to change this setting. Its main purpose is to use as an escape hatch for cheap routers with QoS capability but can only classify flows based on port numbers.

It is a range instead of a single port because of the problems with failing to reconnect to peers if a previous socket to that peer and port is in `TIME_WAIT` state.

name | type | default
--- | --- | ---
peer_tos | int | 0x20

`peer_tos` determines the TOS byte set in the IP header of every packet sent to peers (including web seeds). The default value for this is `0x0` (no marking). One potentially useful TOS mark is `0x20`, this represents the QBone scavenger service. For more details, see QBSS.

name | type | default
--- | --- | ---
active_downloads | int | 3
active_seeds | int | 5
active_checking | int | 1
active_dht_limit | int | 88
active_tracker_limit | int | 1600
active_lsd_limit | int | 60
active_limit | int | 500
active_loaded_limit | int | 0

for auto managed torrents, these are the limits they are subject to. If there are too many torrents some of the auto managed ones will be paused until some slots free up. `active_downloads` and `active_seeds` controls how many active seeding and downloading torrents the queuing mechanism allows. The target number of active torrents is `min(active_downloads + active_seeds, active_limit)`. `active_downloads` and `active_seeds` are upper limits on the number of downloading torrents and seeding torrents respectively. Setting the value to -1 means unlimited. For example if there are 10 seeding torrents and 10 downloading torrents, and `active_downloads` is 4 and `active_seeds` is 4, there will be 4 seeds active and 4 downloading torrents. If the settings are `active_downloads` = 2 and `active_seeds` = 4, then there will be 2 downloading torrents and 4 seeding torrents active. Torrents that are not auto managed are not counted against these limits.

`active_checking` is the limit of number of simultaneous checking torrents.

`active_limit` is a hard limit on the number of active (auto managed) torrents. This limit also applies to slow torrents.

`active_dht_limit` is the max number of torrents to announce to the DHT. By default this is set to 88, which is no more than one DHT announce every 10 seconds.

`active_tracker_limit` is the max number of torrents to announce to their trackers. By default this is 360, which is no more than one announce every 5 seconds.

`active_lsd_limit` is the max number of torrents to announce to the local network over the local service discovery protocol. By default this is 80, which is no more than one announce every 5 seconds (assuming the default announce interval of 5 minutes).

You can have more torrents active, even though they are not announced to the DHT, lsd or their tracker. If some peer knows about you for any reason and tries to connect, it will still be accepted, unless the torrent is paused, which means it won't accept any connections.

`active_loaded_limit` is the number of torrents that are allowed to be loaded at any given time. Note that a torrent can be active even though it's not loaded. If an unloaded torrents finds a peer that wants to access it, the torrent will be loaded on demand, using a user-supplied callback function. If the feature of unloading torrents is not enabled, this setting have no effect. If this limit is set to 0, it means unlimited. For more information, see dynamic loading of torrent files.

name | type | default
--- | --- | ---
auto_manage_interval | int | 30

`auto_manage_interval` is the number of seconds between the torrent queue is updated, and rotated.

name | type | default
--- | --- | ---
seed_time_limit | int | 24 * 60 * 60

this is the limit on the time a torrent has been an active seed (specified in seconds) before it is considered having met the seed limit criteria. See queuing.

name | type | default
--- | --- | ---
auto_scrape_interval | int | 1800
auto_scrape_min_interval | int | 300

`auto_scrape_interval` is the number of seconds between scrapes of queued torrents (auto managed and paused torrents). Auto managed torrents that are paused, are scraped regularly in order to keep track of their downloader/seed ratio. This ratio is used to determine which torrents to seed and which to pause.

`auto_scrape_min_interval` is the minimum number of seconds between any automatic scrape (regardless of torrent). In case there are a large number of paused auto managed torrents, this puts a limit on how often a scrape request is sent.

name | type | default
--- | --- | ---
max_peerlist_size | int | 3000
max_paused_peerlist_size | int | 1000

`max_peerlist_size` is the maximum number of peers in the list of known peers. These peers are not necessarily connected, so this number should be much greater than the maximum number of connected peers. Peers are evicted from the cache when the list grows passed 90% of this limit, and once the size hits the limit, peers are no longer added to the list. If this limit is set to 0, there is no limit on how many peers we'll keep in the peer list.

`max_paused_peerlist_size` is the max peer list size used for torrents that are paused. This default to the same as `max_peerlist_size`, but can be used to save memory for paused torrents, since it's not as important for them to keep a large peer list.

name | type | default
--- | --- | ---
min_announce_interval | int | 5 * 60

this is the minimum allowed announce interval for a tracker. This is specified in seconds and is used as a sanity check on what is returned from a tracker. It mitigates hammering misconfigured trackers.

name | type | default
--- | --- | ---
auto_manage_startup | int | 60

this is the number of seconds a torrent is considered active after it was started, regardless of upload and download speed. This is so that newly started torrents are not considered inactive until they have a fair chance to start downloading.

name | type | default
--- | --- | ---
seeding_piece_quota | int | 20

`seeding_piece_quota` is the number of pieces to send to a peer, when seeding, before rotating in another peer to the unchoke set. It defaults to 3 pieces, which means that when seeding, any peer we've sent more than this number of pieces to will be unchoked in favour of a choked peer.

name | type | default
--- | --- | ---
max_rejects | int | 50

TODO: deprecate this `max_rejects` is the number of piece requests we will reject in a row while a peer is choked before the peer is considered abusive and is disconnected.

name | type | default
--- | --- | ---
recv_socket_buffer_size | int | 0
send_socket_buffer_size | int | 0

`recv_socket_buffer_size` and `send_socket_buffer_size` specifies the buffer sizes set on peer sockets. 0 (which is the default) means the OS default (i.e. don't change the buffer sizes). The socket buffer sizes are changed using setsockopt() with SOL_SOCKET/SO_RCVBUF and SO_SNDBUFFER.

name | type | default
--- | --- | ---
read_cache_line_size | int | 32
write_cache_line_size | int | 16

`read_cache_line_size` is the number of blocks to read into the read cache when a read cache miss occurs. Setting this to 0 is essentially the same thing as disabling read cache. The number of blocks read into the read cache is always capped by the piece boundary.

When a piece in the write cache has `write_cache_line_size` contiguous blocks in it, they will be flushed. Setting this to 1 effectively disables the write cache.

name | type | default
--- | --- | ---
optimistic_disk_retry | int | 10 * 60

`optimistic_disk_retry` is the number of seconds from a disk write errors occur on a torrent until libtorrent will take it out of the upload mode, to test if the error condition has been fixed.

libtorrent will only do this automatically for auto managed torrents.

You can explicitly take a torrent out of upload only mode using set_upload_mode().

name | type | default
--- | --- | ---
max_suggest_pieces | int | 10

`max_suggest_pieces` is the max number of suggested piece indices received from a peer that's remembered. If a peer floods suggest messages, this limit prevents libtorrent from using too much RAM. It defaults to 10.

name | type | default
--- | --- | ---
local_service_announce_interval | int | 5 * 60

`local_service_announce_interval` is the time between local network announces for a torrent. By default, when local service discovery is enabled a torrent announces itself every 5 minutes. This interval is specified in seconds.

name | type | default
--- | --- | ---
dht_announce_interval | int | 15 * 60

`dht_announce_interval` is the number of seconds between announcing torrents to the distributed hash table (DHT).

name | type | default
--- | --- | ---
udp_tracker_token_expiry | int | 60

`udp_tracker_token_expiry` is the number of seconds libtorrent will keep UDP tracker connection tokens around for. This is specified to be 60 seconds, and defaults to that. The higher this value is, the fewer packets have to be sent to the UDP tracker. In order for higher values to work, the tracker needs to be configured to match the expiration time for tokens.

name | type | default
--- | --- | ---
default_cache_min_age | int | 1

`default_cache_min_age` is the minimum number of seconds any read cache line is kept in the cache. This defaults to one second but may be greater if `guided_read_cache` is enabled. Having a lower bound on the time a cache line stays in the cache is an attempt to avoid swapping the same pieces in and out of the cache in case there is a shortage of spare cache space.

name | type | default
--- | --- | ---
num_optimistic_unchoke_slots | int | 0

`num_optimistic_unchoke_slots` is the number of optimistic unchoke slots to use. It defaults to 0, which means automatic. Having a higher number of optimistic unchoke slots mean you will find the good peers faster but with the trade-off to use up more bandwidth. When this is set to 0, libtorrent opens up 20% of your allowed upload slots as optimistic unchoke slots.

name | type | default
--- | --- | ---
default_est_reciprocation_rate | int | 16000
increase_est_reciprocation_rate | int | 20
decrease_est_reciprocation_rate | int | 3

`default_est_reciprocation_rate` is the assumed reciprocation rate from peers when using the BitTyrant choker. This defaults to 14 kiB/s. If set too high, you will over-estimate your peers and be more altruistic while finding the true reciprocation rate, if it's set too low, you'll be too stingy and waste finding the true reciprocation rate.

`increase_est_reciprocation_rate` specifies how many percent the estimated reciprocation rate should be increased by each unchoke interval a peer is still choking us back. This defaults to 20%. This only applies to the BitTyrant choker.

`decrease_est_reciprocation_rate` specifies how many percent the estimated reciprocation rate should be decreased by each unchoke interval a peer unchokes us. This default to 3%. This only applies to the BitTyrant choker.

name | type | default
--- | --- | ---
max_pex_peers | int | 50

the max number of peers we accept from pex messages from a single peer. this limits the number of concurrent peers any of our peers claims to be connected to. If they claim to be connected to more than this, we'll ignore any peer that exceeds this limit

name | type | default
--- | --- | ---
tick_interval | int | 500

`tick_interval` specifies the number of milliseconds between internal ticks. This is the frequency with which bandwidth quota is distributed to peers. It should not be more than one second (i.e. 1000 ms). Setting this to a low value (around 100) means higher resolution bandwidth quota distribution, setting it to a higher value saves CPU cycles.

name | type | default
--- | --- | ---
share_mode_target | int | 3

`share_mode_target` specifies the target share ratio for share mode torrents. This defaults to 3, meaning we'll try to upload 3 times as much as we download. Setting this very high, will make it very conservative and you might end up not downloading anything ever (and not affecting your share ratio). It does not make any sense to set this any lower than 2. For instance, if only 3 peers need to download the rarest piece, it's impossible to download a single piece and upload it more than 3 times. If the share_mode_target is set to more than 3, nothing is downloaded.

name | type | default
--- | --- | ---
upload_rate_limit | int | 0
download_rate_limit | int | 0

`upload_rate_limit` and `download_rate_limit` sets the session-global limits of upload and download rate limits, in bytes per second. By default peers on the local network are not rate limited.

A value of 0 means unlimited.

For fine grained control over rate limits, including making them apply to local peers, see peer classes.

name | type | default
--- | --- | ---
dht_upload_rate_limit | int | 4000

`dht_upload_rate_limit` sets the rate limit on the DHT. This is specified in bytes per second and defaults to 4000. For busy boxes with lots of torrents that requires more DHT traffic, this should be raised.

name | type | default
--- | --- | ---
unchoke_slots_limit | int | 8

`unchoke_slots_limit` is the max number of unchoked peers in the session. The number of unchoke slots may be ignored depending on what `choking_algorithm` is set to.

name | type | default
--- | --- | ---
connections_limit | int | 200

`connections_limit` sets a global limit on the number of connections opened. The number of connections is set to a hard minimum of at least two per torrent, so if you set a too low connections limit, and open too many torrents, the limit will not be met.

name | type | default
--- | --- | ---
connections_slack | int | 10

`connections_slack` is the the number of incoming connections exceeding the connection limit to accept in order to potentially replace existing ones.

name | type | default
--- | --- | ---
utp_target_delay | int | 100
utp_gain_factor | int | 3000
utp_min_timeout | int | 500
utp_syn_resends | int | 2
utp_fin_resends | int | 2
utp_num_resends | int | 3
utp_connect_timeout | int | 3000
utp_loss_multiplier | int | 50

`utp_target_delay` is the target delay for uTP sockets in milliseconds. A high value will make uTP connections more aggressive and cause longer queues in the upload bottleneck. It cannot be too low, since the noise in the measurements would cause it to send too slow. The default is 50 milliseconds. `utp_gain_factor` is the number of bytes the uTP congestion window can increase at the most in one RTT. This defaults to 300 bytes. If this is set too high, the congestion controller reacts too hard to noise and will not be stable, if it's set too low, it will react slow to congestion and not back off as fast. `utp_min_timeout` is the shortest allowed uTP socket timeout, specified in milliseconds. This defaults to 500 milliseconds. The timeout depends on the RTT of the connection, but is never smaller than this value. A connection times out when every packet in a window is lost, or when a packet is lost twice in a row (i.e. the resent packet is lost as well).

The shorter the timeout is, the faster the connection will recover from this situation, assuming the RTT is low enough. `utp_syn_resends` is the number of SYN packets that are sent (and timed out) before giving up and closing the socket. `utp_num_resends` is the number of times a packet is sent (and lossed or timed out) before giving up and closing the connection. `utp_connect_timeout` is the number of milliseconds of timeout for the initial SYN packet for uTP connections. For each timed out packet (in a row), the timeout is doubled. `utp_loss_multiplier` controls how the congestion window is changed when a packet loss is experienced. It's specified as a percentage multiplier for `cwnd`. By default it's set to 50 (i.e. cut in half). Do not change this value unless you know what you're doing. Never set it higher than 100.

name | type | default
--- | --- | ---
mixed_mode_algorithm | int | settings_pack::peer_proportional

The `mixed_mode_algorithm` determines how to treat TCP connections when there are uTP connections. Since uTP is designed to yield to TCP, there's an inherent problem when using swarms that have both TCP and uTP connections. If nothing is done, uTP connections would often be starved out for bandwidth by the TCP connections. This mode is `prefer_tcp`. The `peer_proportional` mode simply looks at the current throughput and rate limits all TCP connections to their proportional share based on how many of the connections are TCP. This works best if uTP connections are not rate limited by the global rate limiter (which they aren't by default).

name | type | default
--- | --- | ---
listen_queue_size | int | 5

`listen_queue_size` is the value passed in to listen() for the listen socket. It is the number of outstanding incoming connections to queue up while we're not actively waiting for a connection to be accepted. The default is 5 which should be sufficient for any normal client. If this is a high performance server which expects to receive a lot of connections, or used in a simulator or test, it might make sense to raise this number. It will not take affect until the `listen_interfaces` settings is updated.

name | type | default
--- | --- | ---
torrent_connect_boost | int | 30

`torrent_connect_boost` is the number of peers to try to connect to immediately when the first tracker response is received for a torrent. This is a boost to given to new torrents to accelerate them starting up. The normal connect scheduler is run once every second, this allows peers to be connected immediately instead of waiting for the session tick to trigger connections. This may not be set higher than 255.

name | type | default
--- | --- | ---
alert_queue_size | int | 1000

`alert_queue_size` is the maximum number of alerts queued up internally. If alerts are not popped, the queue will eventually fill up to this level.

name | type | default
--- | --- | ---
max_metadata_size | int | 3 * 1024 * 10240

`max_metadata_size` is the maximum allowed size (in bytes) to be received by the metadata extension, i.e. magnet links.

name | type | default
--- | --- | ---
checking_mem_usage | int | 1024

the number of blocks to keep outstanding at any given time when checking torrents. Higher numbers give faster re-checks but uses more memory. Specified in number of 16 kiB blocks

name | type | default
--- | --- | ---
predictive_piece_announce | int | 0

if set to > 0, pieces will be announced to other peers before they are fully downloaded (and before they are hash checked). The intention is to gain 1.5 potential round trip times per downloaded piece. When non-zero, this indicates how many milliseconds in advance pieces should be announced, before they are expected to be completed.

name | type | default
--- | --- | ---
aio_threads | int | 4
aio_max | int | 300

for some aio back-ends, `aio_threads` specifies the number of io-threads to use, and `aio_max` the max number of outstanding jobs.

name | type | default
--- | --- | ---
network_threads | int | 0

`network_threads` is the number of threads to use to call `async_write_some` (i.e. send) on peer connection sockets. When seeding at extremely high rates, this may become a bottleneck, and setting this to 2 or more may parallelize that cost. When using SSL torrents, all encryption for outgoing traffic is done within the socket send functions, and this will help parallelizing the cost of SSL encryption as well.

name | type | default
--- | --- | ---
ssl_listen | int | 0

`ssl_listen` sets the listen port for SSL connections. If this is set to 0, no SSL listen port is opened. Otherwise a socket is opened on this port. This setting is only taken into account when opening the regular listen port, and won't re-open the listen socket simply by changing this setting.

name | type | default
--- | --- | ---
tracker_backoff | int | 250

`tracker_backoff` determines how aggressively to back off from retrying failing trackers. This value determines x in the following formula, determining the number of seconds to wait until the next retry:

> delay = 5 + 5 * x / 100 * fails^2

This setting may be useful to make libtorrent more or less aggressive in hitting trackers.

name | type | default
--- | --- | ---
share_ratio_limit | int | 200
seed_time_ratio_limit | int | 700

when a seeding torrent reaches either the share ratio (bytes up / bytes down) or the seed time ratio (seconds as seed / seconds as downloader) or the seed time limit (seconds as seed) it is considered done, and it will leave room for other torrents. These are specified as percentages. Torrents that are considered done will still be allowed to be seeded, they just won't have priority anymore. For more, see queuing.

name | type | default
--- | --- | ---
peer_turnover | int | 4
peer_turnover_cutoff | int | 90
peer_turnover_interval | int | 300

peer_turnover is the percentage of peers to disconnect every turnover peer_turnover_interval (if we're at the peer limit), this is specified in percent when we are connected to more than limit * peer_turnover_cutoff peers disconnect peer_turnover fraction of the peers. It is specified in percent peer_turnover_interval is the interval (in seconds) between optimistic disconnects if the disconnects happen and how many peers are disconnected is controlled by peer_turnover and peer_turnover_cutoff

name | type | default
--- | --- | ---
connect_seed_every_n_download | int | 10

this setting controls the priority of downloading torrents over seeding or finished torrents when it comes to making peer connections. Peer connections are throttled by the connection_speed and the half-open connection limit. This makes peer connections a limited resource. Torrents that still have pieces to download are prioritized by default, to avoid having many seeding torrents use most of the connection attempts and only give one peer every now and then to the downloading torrent. libtorrent will loop over the downloading torrents to connect a peer each, and every n:th connection attempt, a finished torrent is picked to be allowed to connect to a peer. This setting controls n.

name | type | default
--- | --- | ---
max_http_recv_buffer_size | int | 4*1024*204

the max number of bytes to allow an HTTP response to be when announcing to trackers or downloading .torrent files via the `url` provided in `add_torrent_params`.

name | type | default
--- | --- | ---
max_retry_port_bind | int | 10

if binding to a specific port fails, should the port be incremented by one and tried again? This setting specifies how many times to retry a failed port bind

name | type | default
--- | --- | ---
alert_mask | int | alert::error_notification

a bitmask combining flags from alert::category_t defining which kinds of alerts to receive

name | type | default
--- | --- | ---
out_enc_policy | int | settings_pack::pe_enabled
in_enc_policy | int | settings_pack::pe_enabled

control the settings for incoming and outgoing connections respectively. see enc_policy enum for the available options. Keep in mind that protocol encryption degrades performance in several respects:

1. It prevents "zero copy" disk buffers being sent to peers, since each peer needs to mutate the data (i.e. encrypt it) the data must be copied per peer connection rather than sending the same buffer to multiple peers.
2. The encryption itself requires more CPU than plain bittorrent protocol. The highest cost is the Diffie Hellman exchange on connection setup.
3. The encryption handshake adds several round-trips to the connection setup, and delays transferring data.

name | type | default
--- | --- | ---
allowed_enc_level | int | settings_pack::pe_both

determines the encryption level of the connections. This setting will adjust which encryption scheme is offered to the other peer, as well as which encryption scheme is selected by the client. See enc_level enum for options.

name | type | default
--- | --- | ---
inactive_down_rate | int | 2048
inactive_up_rate | int | 2048

the download and upload rate limits for a torrent to be considered active by the queuing mechanism. A torrent whose download rate is less than `inactive_down_rate` and whose upload rate is less than `inactive_up_rate` for `auto_manage_startup` seconds, is considered inactive, and another queued torrent may be started. This logic is disabled if `dont_count_slow_torrents` is false.

name | type | default
--- | --- | ---
proxy_type | int | settings_pack::none

proxy to use, defaults to none. see proxy_type_t.

name | type | default
--- | --- | ---
proxy_port | int | 0

the port of the proxy server

name | type | default
--- | --- | ---
i2p_port | int | 0

sets the i2p SAM bridge port to connect to. set the hostname with the `i2p_hostname` setting.

name | type | default
--- | --- | ---
cache_size_volatile | int | 256

this determines the max number of volatile disk cache blocks. If the number of volatile blocks exceed this limit, other volatile blocks will start to be evicted. A disk cache block is volatile if it has low priority, and should be one of the first blocks to be evicted under pressure. For instance, blocks pulled into the cache as the result of calculating a piece hash are volatile. These blocks don't represent potential interest among peers, so the value of keeping them in the cache is limited.

name | type | default
--- | --- | ---
urlseed_max_request_bytes | int | 16 * 1024 * 1024

The maximum request range of an url seed in bytes. This value defines the largest possible sequential web seed request. Default is 16 * 1024 * 1024. Lower values are possible but will be ignored if they are lower then piece size. This value should be related to your download speed to prevent libtorrent from creating too many expensive http requests per second. You can select a value as high as you want but keep in mind that libtorrent can't create parallel requests if the first request did already select the whole file. If you combine bittorrent seeds with web seeds and pick strategies like rarest first you may find your web seed requests split into smaller parts because we don't download already picked pieces twice.

name | type | default
--- | --- | ---
web_seed_name_lookup_retry | int | 1800

time to wait until a new retry of a web seed name lookup

name | type | default
--- | --- | ---
close_file_interval | int | CLOSE_FILE_INTERVAL

the number of seconds between closing the file opened the longest ago. 0 means to disable the feature. The purpose of this is to periodically close files to trigger the operating system flushing disk cache. Specifically it has been observed to be required on windows to not have the disk cache grow indefinitely. This defaults to 120 seconds on windows, and disabled on other systems.

name | type | default
--- | --- | ---
utp_cwnd_reduce_timer | int | 100

When uTP experiences packet loss, it will reduce the congestion window, and not reduce it again for this many milliseconds, even if experiencing another lost packet.

    struct settings_pack
    {
       void set_int (int name, int val);
       void set_str (int name, std::string val);
       void set_bool (int name, bool val);
       bool has_val (int name) const;
       void clear ();
       void clear (int name);
       bool get_bool (int name) const;
       int get_int (int name) const;
       std::string get_str (int name) const;

       enum type_bases
       {
          string_type_base,
          int_type_base,
          bool_type_base,
          type_mask,
          index_mask,
       };

       enum string_types
       {
          user_agent,
          announce_ip,
          deprecated12,
          handshake_client_version,
          outgoing_interfaces,
          listen_interfaces,
          proxy_hostname,
          proxy_username,
          proxy_password,
          i2p_hostname,
          peer_fingerprint,
          dht_bootstrap_nodes,
          max_string_setting_internal,
       };

       enum bool_types
       {
          allow_multiple_connections_per_ip,
          deprecated1,
          send_redundant_have,
          lazy_bitfields,
          use_dht_as_fallback,
          upnp_ignore_nonrouters,
          use_parole_mode,
          use_read_cache,
          deprecated7,
          deprecated10,
          deprecated13,
          coalesce_reads,
          coalesce_writes,
          auto_manage_prefer_seeds,
          dont_count_slow_torrents,
          close_redundant_connections,
          prioritize_partial_pieces,
          rate_limit_ip_overhead,
          announce_to_all_tiers,
          announce_to_all_trackers,
          prefer_udp_trackers,
          strict_super_seeding,
          deprecated8,
          disable_hash_checks,
          allow_i2p_mixed,
          low_prio_disk,
          volatile_read_cache,
          guided_read_cache,
          no_atime_storage,
          incoming_starts_queued_torrents,
          report_true_downloaded,
          strict_end_game_mode,
          broadcast_lsd,
          enable_outgoing_utp,
          enable_incoming_utp,
          enable_outgoing_tcp,
          enable_incoming_tcp,
          ignore_resume_timestamps,
          no_recheck_incomplete_resume,
          anonymous_mode,
          report_web_seed_downloads,
          deprecated2,
          announce_double_nat,
          seeding_outgoing_connections,
          no_connect_privileged_ports,
          smooth_connects,
          always_send_user_agent,
          apply_ip_filter_to_trackers,
          use_disk_read_ahead,
          lock_files,
          contiguous_recv_buffer,
          ban_web_seeds,
          allow_partial_disk_writes,
          force_proxy,
          support_share_mode,
          support_merkle_torrents,
          report_redundant_bytes,
          listen_system_port_fallback,
          use_disk_cache_pool,
          announce_crypto_support,
          enable_upnp,
          enable_natpmp,
          enable_lsd,
          enable_dht,
          prefer_rc4,
          proxy_hostnames,
          proxy_peer_connections,
          auto_sequential,
          proxy_tracker_connections,
          max_bool_setting_internal,
       };

       enum int_types
       {
          tracker_completion_timeout,
          tracker_receive_timeout,
          stop_tracker_timeout,
          tracker_maximum_response_length,
          piece_timeout,
          request_timeout,
          request_queue_time,
          max_allowed_in_request_queue,
          max_out_request_queue,
          whole_pieces_threshold,
          peer_timeout,
          urlseed_timeout,
          urlseed_pipeline_size,
          urlseed_wait_retry,
          file_pool_size,
          max_failcount,
          min_reconnect_time,
          peer_connect_timeout,
          connection_speed,
          inactivity_timeout,
          unchoke_interval,
          optimistic_unchoke_interval,
          num_want,
          initial_picker_threshold,
          allowed_fast_set_size,
          suggest_mode,
          max_queued_disk_bytes,
          handshake_timeout,
          send_buffer_low_watermark,
          send_buffer_watermark,
          send_buffer_watermark_factor,
          choking_algorithm,
          seed_choking_algorithm,
          cache_size,
          cache_buffer_chunk_size,
          cache_expiry,
          deprecated11,
          disk_io_write_mode,
          disk_io_read_mode,
          outgoing_port,
          num_outgoing_ports,
          peer_tos,
          active_downloads,
          active_seeds,
          active_checking,
          active_dht_limit,
          active_tracker_limit,
          active_lsd_limit,
          active_limit,
          active_loaded_limit,
          auto_manage_interval,
          seed_time_limit,
          auto_scrape_interval,
          auto_scrape_min_interval,
          max_peerlist_size,
          max_paused_peerlist_size,
          min_announce_interval,
          auto_manage_startup,
          seeding_piece_quota,
          max_rejects,
          recv_socket_buffer_size,
          send_socket_buffer_size,
          deprecated14,
          read_cache_line_size,
          write_cache_line_size,
          optimistic_disk_retry,
          max_suggest_pieces,
          local_service_announce_interval,
          dht_announce_interval,
          udp_tracker_token_expiry,
          default_cache_min_age,
          num_optimistic_unchoke_slots,
          default_est_reciprocation_rate,
          increase_est_reciprocation_rate,
          decrease_est_reciprocation_rate,
          max_pex_peers,
          tick_interval,
          share_mode_target,
          upload_rate_limit,
          download_rate_limit,
          deprecated3,
          deprecated4,
          dht_upload_rate_limit,
          unchoke_slots_limit,
          deprecated5,
          connections_limit,
          connections_slack,
          utp_target_delay,
          utp_gain_factor,
          utp_min_timeout,
          utp_syn_resends,
          utp_fin_resends,
          utp_num_resends,
          utp_connect_timeout,
          deprecated6,
          utp_loss_multiplier,
          mixed_mode_algorithm,
          listen_queue_size,
          torrent_connect_boost,
          alert_queue_size,
          max_metadata_size,
          deprecated9,
          checking_mem_usage,
          predictive_piece_announce,
          aio_threads,
          aio_max,
          network_threads,
          ssl_listen,
          tracker_backoff,
          share_ratio_limit,
          seed_time_ratio_limit,
          peer_turnover,
          peer_turnover_cutoff,
          peer_turnover_interval,
          connect_seed_every_n_download,
          max_http_recv_buffer_size,
          max_retry_port_bind,
          alert_mask,
          out_enc_policy,
          in_enc_policy,
          allowed_enc_level,
          inactive_down_rate,
          inactive_up_rate,
          proxy_type,
          proxy_port,
          i2p_port,
          cache_size_volatile,
          urlseed_max_request_bytes,
          web_seed_name_lookup_retry,
          close_file_interval,
          utp_cwnd_reduce_timer,
          max_int_setting_internal,
       };

       enum settings_counts_t
       {
          num_string_settings,
          num_bool_settings,
          num_int_settings,
       };

       enum suggest_mode_t
       {
          no_piece_suggestions,
          suggest_read_cache,
       };

       enum choking_algorithm_t
       {
          fixed_slots_choker,
          rate_based_choker,
          bittyrant_choker,
       };

       enum seed_choking_algorithm_t
       {
          round_robin,
          fastest_upload,
          anti_leech,
       };

       enum io_buffer_mode_t
       {
          enable_os_cache,
          deprecated,
          disable_os_cache,
       };

       enum bandwidth_mixed_algo_t
       {
          prefer_tcp,
          peer_proportional,
       };

       enum enc_policy
       {
          pe_forced,
          pe_enabled,
          pe_disabled,
       };

       enum enc_level
       {
          pe_plaintext,
          pe_rc4,
          pe_both,
       };

       enum proxy_type_t
       {
          none,
          socks4,
          socks5,
          socks5_pw,
          http,
          http_pw,
          i2p_proxy,
       };
    };

### clear()

    void clear ();

clear the settings pack from all settings

### clear()

    void clear (int name);

clear a specific setting from the pack

### enum type_bases

Declared in "libtorrent/settings_pack.hpp"

name | value | description
--- | --- | ---
string_type_base | 0 |
int_type_base | 16384 |
bool_type_base | 32768 |
type_mask | 49152 |
index_mask | 16383 |

### enum string_types

Declared in "libtorrent/settings_pack.hpp"

name | value | description
--- | --- | ---
user_agent |  | this is the client identification to the tracker. The recommended format of this string is: "ClientName/ClientVersion libtorrent/libtorrentVersion". This name will not only be used when making HTTP requests, but also when sending extended headers to peers that support that extension. It may not contain r or n
announce_ip | 1 | `announce_ip` is the ip address passed along to trackers as the `&ip=` parameter. If left as the default, that parameter is omitted.
deprecated12 | 2 |
handshake_client_version | 3 | this is the client name and version identifier sent to peers in the handshake message. If this is an empty string, the user_agent is used instead

outgoing_interfaces

4

sets the network interface this session will use when it opens outgoing connections. By default, it binds outgoing connections to INADDR_ANY and port 0 (i.e. let the OS decide). Ths parameter must be a string containing one or more, comma separated, adapter names. Adapter names on unix systems are of the form "eth0", "eth1", "tun0", etc. When specifying multiple interfaces, they will be assigned in round-robin order. This may be useful for clients that are multi-homed. Binding an outgoing connection to a local IP does not necessarily make the connection via the associated NIC/Adapter. Setting this to an empty string will disable binding of outgoing connections.

listen_interfaces

5

a comma-separated list of IP port-pairs. These are the listen ports that will be opened for accepting incoming uTP and TCP connections. It is possible to listen on multiple IPs and multiple ports. Binding to port 0 will make the operating system pick the port. The default is "0.0.0.0:6881", which binds to all interfaces on port 6881.

If binding fails because the port is busy, the port number will be incremented by one, `settings_pack::max_retry_port_bind` times.

if all retry attempts fail, the socket will be bound to port 0, meaning the operating system will pick a port. This behavior can be disabled by disabling `settings_pack::listen_system_port_fallback`.

if binding fails, the listen_failed_alert is posted, potentially more than once. Once/if binding the listen socket(s) succeed, listen_succeeded_alert is posted.

Each port will attempt to open both a UDP and a TCP listen socket, to allow accepting uTP connections as well as TCP. If using the DHT, this will also make the DHT use the same UDP ports.

Note

The current support for opening arbitrary UDP sockets is limited. In this version of libtorrent, there will only ever be two UDP sockets, one for IPv4 and one for IPv6.

proxy_hostname | 6 | when using a poxy, this is the hostname where the proxy is running see proxy_type.
proxy_username | 7 | when using a proxy, these are the credentials (if any) to use whne connecting to it. see proxy_type
proxy_password | 8 |
i2p_hostname | 9 | sets the i2p SAM bridge to connect to. set the port with the `i2p_port` setting.
peer_fingerprint | 10 | this is the fingerprint for the client. It will be used as the prefix to the peer_id. If this is 20 bytes (or longer) it will be truncated to 20 bytes and used as the entire peer-id There is a utility function, generate_fingerprint() that can be used to generate a standard client peer ID fingerprint prefix.
dht_bootstrap_nodes | 11 | This is a comma-separated list of IP port-pairs. They will be added to the DHT node (if it's enabled) as back-up nodes in case we don't know of any. This setting will contain one or more bootstrap nodes by default. Changing these after the DHT has been started may not have any effect until the DHT is restarted.
max_string_setting_internal | 12 |

### enum bool_types

Declared in "libtorrent/settings_pack.hpp"

name | value | description
--- | --- | ---
allow_multiple_connections_per_ip |  | determines if connections from the same IP address as existing connections should be rejected or not. Multiple connections from the same IP address is not allowed by default, to prevent abusive behavior by peers. It may be useful to allow such connections in cases where simulations are run on the same machine, and all peers in a swarm has the same IP address.
deprecated1 | 1 |
send_redundant_have | 2 | `send_redundant_have` controls if have messages will be sent to peers that already have the piece. This is typically not necessary, but it might be necessary for collecting statistics in some cases. Default is false.
lazy_bitfields | 3 | if this is true, outgoing bitfields will never be fuil. If the client is seed, a few bits will be set to 0, and later filled in with have messages. This is to prevent certain ISPs from stopping people from seeding.
use_dht_as_fallback | 4 | `use_dht_as_fallback` determines how the DHT is used. If this is true, the DHT will only be used for torrents where all trackers in its tracker list has failed. Either by an explicit error message or a time out. This is false by default, which means the DHT is used by default regardless of if the trackers fail or not.
upnp_ignore_nonrouters | 5 | `upnp_ignore_nonrouters` indicates whether or not the UPnP implementation should ignore any broadcast response from a device whose address is not the configured router for this machine. i.e. it's a way to not talk to other people's routers by mistake.

use_parole_mode

6

`use_parole_mode` specifies if parole mode should be used. Parole mode means that peers that participate in pieces that fail the hash check are put in a mode where they are only allowed to download whole pieces. If the whole piece a peer in parole mode fails the hash check, it is banned. If a peer participates in a piece that passes the hash check, it is taken out of parole mode.

use_read_cache | 7 | enable and disable caching of blocks read from disk. the purpose of the read cache is partly read-ahead of requests but also to avoid reading blocks back from the disk multiple times for popular pieces.
deprecated7 | 8 |
deprecated10 | 9 |
deprecated13 | 10 |
coalesce_reads | 11 | allocate separate, contiguous, buffers for read and write calls. Only used where writev/readv cannot be used will use more RAM but may improve performance
coalesce_writes | 12 |
auto_manage_prefer_seeds | 13 | prefer seeding torrents when determining which torrents to give active slots to, the default is false which gives preference to downloading torrents
dont_count_slow_torrents | 14 | if `dont_count_slow_torrents` is true, torrents without any payload transfers are not subject to the `active_seeds` and `active_downloads` limits. This is intended to make it more likely to utilize all available bandwidth, and avoid having torrents that don't transfer anything block the active slots.
close_redundant_connections | 15 | `close_redundant_connections` specifies whether libtorrent should close connections where both ends have no utility in keeping the connection open. For instance if both ends have completed their downloads, there's no point in keeping it open.
prioritize_partial_pieces | 16 | If `prioritize_partial_pieces` is true, partial pieces are picked before pieces that are more rare. If false, rare pieces are always prioritized, unless the number of partial pieces is growing out of proportion.
rate_limit_ip_overhead | 17 | if set to true, the estimated TCP/IP overhead is drained from the rate limiters, to avoid exceeding the limits with the total traffic

announce_to_all_tiers

18

`announce_to_all_trackers` controls how multi tracker torrents are treated. If this is set to true, all trackers in the same tier are announced to in parallel. If all trackers in tier 0 fails, all trackers in tier 1 are announced as well. If it's set to false, the behavior is as defined by the multi tracker specification. It defaults to false, which is the same behavior previous versions of libtorrent has had as well.

`announce_to_all_tiers` also controls how multi tracker torrents are treated. When this is set to true, one tracker from each tier is announced to. This is the uTorrent behavior. This is false by default in order to comply with the multi-tracker specification.

announce_to_all_trackers | 19 |
prefer_udp_trackers | 20 | `prefer_udp_trackers` is true by default. It means that trackers may be rearranged in a way that udp trackers are always tried before http trackers for the same hostname. Setting this to false means that the trackers' tier is respected and there's no preference of one protocol over another.
strict_super_seeding | 21 | `strict_super_seeding` when this is set to true, a piece has to have been forwarded to a third peer before another one is handed out. This is the traditional definition of super seeding.
deprecated8 | 22 |
disable_hash_checks | 23 | when set to true, all data downloaded from peers will be assumed to be correct, and not tested to match the hashes in the torrent this is only useful for simulation and testing purposes (typically combined with disabled_storage)
allow_i2p_mixed | 24 | if this is true, i2p torrents are allowed to also get peers from other sources than the tracker, and connect to regular IPs, not providing any anonymization. This may be useful if the user is not interested in the anonymization of i2p, but still wants to be able to connect to i2p peers.

low_prio_disk

25

`low_prio_disk` determines if the disk I/O should use a normal or low priority policy. This defaults to true, which means that it's low priority by default. Other processes doing disk I/O will normally take priority in this mode. This is meant to improve the overall responsiveness of the system while downloading in the background. For high-performance server setups, this might not be desirable.

volatile_read_cache | 26 | `volatile_read_cache`, if this is set to true, read cache blocks that are hit by peer read requests are removed from the disk cache to free up more space. This is useful if you don't expect the disk cache to create any cache hits from other peers than the one who triggered the cache line to be read into the cache in the first place.
guided_read_cache | 27 | `guided_read_cache` enables the disk cache to adjust the size of a cache line generated by peers to depend on the upload rate you are sending to that peer. The intention is to optimize the RAM usage of the cache, to read ahead further for peers that you're sending faster to.
no_atime_storage | 28 | `no_atime_storage` this is a linux-only option and passes in the `O_NOATIME` to `open()` when opening files. This may lead to some disk performance improvements.

incoming_starts_queued_torrents

29

`incoming_starts_queued_torrents` defaults to false. If a torrent has been paused by the auto managed feature in libtorrent, i.e. the torrent is paused and auto managed, this feature affects whether or not it is automatically started on an incoming connection. The main reason to queue torrents, is not to make them unavailable, but to save on the overhead of announcing to the trackers, the DHT and to avoid spreading one's unchoke slots too thin. If a peer managed to find us, even though we're no in the torrent anymore, this setting can make us start the torrent and serve it.

report_true_downloaded | 30 | when set to true, the downloaded counter sent to trackers will include the actual number of payload bytes downloaded including redundant bytes. If set to false, it will not include any redundancy bytes

strict_end_game_mode

31

`strict_end_game_mode` defaults to true, and controls when a block may be requested twice. If this is `true`, a block may only be requested twice when there's ay least one request to every piece that's left to download in the torrent. This may slow down progress on some pieces sometimes, but it may also avoid downloading a lot of redundant bytes. If this is `false`, libtorrent attempts to use each peer connection to its max, by always requesting something, even if it means requesting something that has been requested from another peer already.

broadcast_lsd | 32 | if `broadcast_lsd` is set to true, the local peer discovery (or Local Service Discovery) will not only use IP multicast, but also broadcast its messages. This can be useful when running on networks that don't support multicast. Since broadcast messages might be expensive and disruptive on networks, only every 8th announce uses broadcast.
enable_outgoing_utp | 33 | when set to true, libtorrent will try to make outgoing utp connections controls whether libtorrent will accept incoming connections or make outgoing connections of specific type.
enable_incoming_utp | 34 |
enable_outgoing_tcp | 35 |
enable_incoming_tcp | 36 |

ignore_resume_timestamps

37

`ignore_resume_timestamps` determines if the storage, when loading resume data files, should verify that the file modification time with the timestamps in the resume data. This defaults to false, which means timestamps are taken into account, and resume data is less likely to accepted (torrents are more likely to be fully checked when loaded). It might be useful to set this to true if your network is faster than your disk, and it would be faster to redownload potentially missed pieces than to go through the whole storage to look for them.

no_recheck_incomplete_resume | 38 | `no_recheck_incomplete_resume` determines if the storage should check the whole files when resume data is incomplete or missing or whether it should simply assume we don't have any of the data. By default, this is determined by the existence of any of the files. By setting this setting to true, the files won't be checked, but will go straight to download mode.

anonymous_mode

39

`anonymous_mode` defaults to false. When set to true, the client tries to hide its identity to a certain degree. The user-agent will be reset to an empty string (except for private torrents). Trackers will only be used if they are using a proxy server. The listen sockets are closed, and incoming connections will only be accepted through a SOCKS5 or I2P proxy (if a peer proxy is set up and is run on the same machine as the tracker proxy). Since no incoming connections are accepted, NAT-PMP, UPnP, DHT and local peer discovery are all turned off when this setting is enabled.

If you're using I2P, it might make sense to enable anonymous mode as well.

report_web_seed_downloads | 40 | specifies whether downloads from web seeds is reported to the tracker or not. Defaults to on. Turning it off also excludes web seed traffic from other stats and download rate reporting via the libtorrent API.
deprecated2 | 41 |
announce_double_nat | 42 | if this is true, the `&ip=` argument in tracker requests (unless otherwise specified) will be set to the intermediate IP address if the user is double NATed. If the user is not double NATed, this option does not have an affect

seeding_outgoing_connections

43

`seeding_outgoing_connections` determines if seeding (and finished) torrents should attempt to make outgoing connections or not. By default this is true. It may be set to false in very specific applications where the cost of making outgoing connections is high, and there are no or small benefits of doing so. For instance, if no nodes are behind a firewall or a NAT, seeds don't need to make outgoing connections.

no_connect_privileged_ports | 44 | when this is true, libtorrent will not attempt to make outgoing connections to peers whose port is < 1024. This is a safety precaution to avoid being part of a DDoS attack

smooth_connects

45

`smooth_connects` is true by default, which means the number of connection attempts per second may be limited to below the `connection_speed`, in case we're close to bump up against the limit of number of connections. The intention of this setting is to more evenly distribute our connection attempts over time, instead of attempting to connect in batches, and timing them out in batches.

always_send_user_agent | 46 | always send user-agent in every web seed request. If false, only the first request per http connection will include the user agent
apply_ip_filter_to_trackers | 47 | `apply_ip_filter_to_trackers` defaults to true. It determines whether the IP filter applies to trackers as well as peers. If this is set to false, trackers are exempt from the IP filter (if there is one). If no IP filter is set, this setting is irrelevant.
use_disk_read_ahead | 48 | `use_disk_read_ahead` defaults to true and will attempt to optimize disk reads by giving the operating system heads up of disk read requests as they are queued in the disk job queue.
lock_files | 49 | `lock_files` determines whether or not to lock files which libtorrent is downloading to or seeding from. This is implemented using `fcntl(F_SETLK)` on unix systems and by not passing in `SHARE_READ` and `SHARE_WRITE` on windows. This might prevent 3rd party processes from corrupting the files under libtorrent's feet.

contiguous_recv_buffer

50

`contiguous_recv_buffer` determines whether or not libtorrent should receive data from peers into a contiguous intermediate buffer, to then copy blocks into disk buffers from, or to make many smaller calls to `read()`, each time passing in the specific buffer the data belongs in. When downloading at high rates, the latter may save some time copying data. When seeding at high rates, all incoming traffic consists of a very large number of tiny packets, and enabling `contiguous_recv_buffer` will provide higher performance. When this is enabled, it will only be used when seeding to peers, since that's when it provides performance improvements.

ban_web_seeds | 51 | when true, web seeds sending bad data will be banned
allow_partial_disk_writes | 52 | when set to false, the `write_cache_line_size` will apply across piece boundaries. this is a bad idea unless the piece picker also is configured to have an affinity to pick pieces belonging to the same write cache line as is configured in the disk cache.
force_proxy | 53 | If true, disables any communication that's not going over a proxy. Enabling this requires a proxy to be configured as well, see proxy_type and proxy_hostname settings. The listen sockets are closed, and incoming connections will only be accepted through a SOCKS5 or I2P proxy (if a peer proxy is set up and is run on the same machine as the tracker proxy).
support_share_mode | 54 | if false, prevents libtorrent to advertise share-mode support
support_merkle_torrents | 55 | if this is false, don't advertise support for the Tribler merkle tree piece message
report_redundant_bytes | 56 | if this is true, the number of redundant bytes is sent to the tracker
listen_system_port_fallback | 57 | if this is true, libtorrent will fall back to listening on a port chosen by the operating system (i.e. binding to port 0). If a failure is preferred, set this to false.
use_disk_cache_pool | 58 | `use_disk_cache_pool` enables using a pool allocator for disk cache blocks. Enabling it makes the cache perform better at high throughput. It also makes the cache less likely and slower at returning memory back to the system, once allocated.
announce_crypto_support | 59 | when this is true, and incoming encrypted connections are enabled, &supportcrypt=1 is included in http tracker announces

enable_upnp

60

Starts and stops the UPnP service. When started, the listen port and the DHT port are attempted to be forwarded on local UPnP router devices.

The upnp object returned by `start_upnp()` can be used to add and remove arbitrary port mappings. Mapping status is returned through the portmap_alert and the portmap_error_alert. The object will be valid until `stop_upnp()` is called. See upnp and nat pmp.

enable_natpmp

61

Starts and stops the NAT-PMP service. When started, the listen port and the DHT port are attempted to be forwarded on the router through NAT-PMP.

The natpmp object returned by `start_natpmp()` can be used to add and remove arbitrary port mappings. Mapping status is returned through the portmap_alert and the portmap_error_alert. The object will be valid until `stop_natpmp()` is called. See upnp and nat pmp.

enable_lsd | 62 | Starts and stops Local Service Discovery. This service will broadcast the infohashes of all the non-private torrents on the local network to look for peers on the same swarm within multicast reach.
enable_dht | 63 | starts the dht node and makes the trackerless service available to torrents.
prefer_rc4 | 64 | if the allowed encryption level is both, setting this to true will prefer rc4 if both methods are offered, plaintext otherwise
proxy_hostnames | 65 | if true, hostname lookups are done via the configured proxy (if any). This is only supported by SOCKS5 and HTTP.
proxy_peer_connections | 66 | if true, peer connections are made (and accepted) over the configured proxy, if any. Web seeds as well as regular bittorrent peer connections are considered "peer connections". Anything transporting actual torrent payload (trackers and DHT traffic are not considered peer connections).
auto_sequential | 67 | if this setting is true, torrents with a very high availability of pieces (and seeds) are downloaded sequentially. This is more efficient for the disk I/O. With many seeds, the download order is unlikely to matter anyway
proxy_tracker_connections | 68 | if true, tracker connections are made over the configured proxy, if any.
max_bool_setting_internal | 69 |

### enum int_types

Declared in "libtorrent/settings_pack.hpp"

name | value | description
--- | --- | ---
tracker_completion_timeout |  | `tracker_completion_timeout` is the number of seconds the tracker connection will wait from when it sent the request until it considers the tracker to have timed-out. Default value is 60 seconds.
tracker_receive_timeout | 1 | `tracker_receive_timeout` is the number of seconds to wait to receive any data from the tracker. If no data is received for this number of seconds, the tracker will be considered as having timed out. If a tracker is down, this is the kind of timeout that will occur.
stop_tracker_timeout | 2 | the time to wait when sending a stopped message before considering a tracker to have timed out. this is usually shorter, to make the client quit faster

tracker_maximum_response_length

3

this is the maximum number of bytes in a tracker response. If a response size passes this number of bytes it will be rejected and the connection will be closed. On gzipped responses this size is measured on the uncompressed data. So, if you get 20 bytes of gzip response that'll expand to 2 megabytes, it will be interrupted before the entire response has been uncompressed (assuming the limit is lower than 2 megs).

piece_timeout | 4 | the number of seconds from a request is sent until it times out if no piece response is returned.
request_timeout | 5 | the number of seconds one block (16kB) is expected to be received within. If it's not, the block is requested from a different peer
request_queue_time | 6 | the length of the request queue given in the number of seconds it should take for the other end to send all the pieces. i.e. the actual number of requests depends on the download rate and this number.
max_allowed_in_request_queue | 7 | the number of outstanding block requests a peer is allowed to queue up in the client. If a peer sends more requests than this (before the first one has been sent) the last request will be dropped. the higher this is, the faster upload speeds the client can get to a single peer.
max_out_request_queue | 8 | `max_out_request_queue` is the maximum number of outstanding requests to send to a peer. This limit takes precedence over `request_queue_time`. i.e. no matter the download speed, the number of outstanding requests will never exceed this limit.
whole_pieces_threshold | 9 | if a whole piece can be downloaded in this number of seconds, or less, the peer_connection will prefer to request whole pieces at a time from this peer. The benefit of this is to better utilize disk caches by doing localized accesses and also to make it easier to identify bad peers if a piece fails the hash check.
peer_timeout | 10 | `peer_timeout` is the number of seconds the peer connection should wait (for any activity on the peer connection) before closing it due to time out. This defaults to 120 seconds, since that's what's specified in the protocol specification. After half the time out, a keep alive message is sent.
urlseed_timeout | 11 | same as peer_timeout, but only applies to url-seeds. this is usually set lower, because web servers are expected to be more reliable.
urlseed_pipeline_size | 12 | controls the pipelining size of url-seeds. i.e. the number of HTTP request to keep outstanding before waiting for the first one to complete. It's common for web servers to limit this to a relatively low number, like 5
urlseed_wait_retry | 13 | time to wait until a new retry of a web seed takes place

file_pool_size

14

sets the upper limit on the total number of files this session will keep open. The reason why files are left open at all is that some anti virus software hooks on every file close, and scans the file for viruses. deferring the closing of the files will be the difference between a usable system and a completely hogged down system. Most operating systems also has a limit on the total number of file descriptors a process may have open.

max_failcount | 15 | `max_failcount` is the maximum times we try to connect to a peer before stop connecting again. If a peer succeeds, the failcounter is reset. If a peer is retrieved from a peer source (other than DHT) the failcount is decremented by one, allowing another try.
min_reconnect_time | 16 | the number of seconds to wait to reconnect to a peer. this time is multiplied with the failcount.
peer_connect_timeout | 17 | `peer_connect_timeout` the number of seconds to wait after a connection attempt is initiated to a peer until it is considered as having timed out. This setting is especially important in case the number of half-open connections are limited, since stale half-open connection may delay the connection of other peers considerably.
connection_speed | 18 | `connection_speed` is the number of connection attempts that are made per second. If a number < 0 is specified, it will default to 200 connections per second. If 0 is specified, it means don't make outgoing connections at all.
inactivity_timeout | 19 | if a peer is uninteresting and uninterested for longer than this number of seconds, it will be disconnected. default is 10 minutes
unchoke_interval | 20 | `unchoke_interval` is the number of seconds between chokes/unchokes. On this interval, peers are re-evaluated for being choked/unchoked. This is defined as 30 seconds in the protocol, and it should be significantly longer than what it takes for TCP to ramp up to it's max rate.
optimistic_unchoke_interval | 21 | `optimistic_unchoke_interval` is the number of seconds between each optimistic unchoke. On this timer, the currently optimistically unchoked peer will change.
num_want | 22 | `num_want` is the number of peers we want from each tracker request. It defines what is sent as the `&num_want=` parameter to the tracker.
initial_picker_threshold | 23 | `initial_picker_threshold` specifies the number of pieces we need before we switch to rarest first picking. This defaults to 4, which means the 4 first pieces in any torrent are picked at random, the following pieces are picked in rarest first order.
allowed_fast_set_size | 24 | the number of allowed pieces to send to peers that supports the fast extensions

suggest_mode

25

`suggest_mode` controls whether or not libtorrent will send out suggest messages to create a bias of its peers to request certain pieces. The modes are:

- `no_piece_suggestions` which is the default and will not send out suggest messages.
- `suggest_read_cache` which will send out suggest messages for the most recent pieces that are in the read cache.

max_queued_disk_bytes

26

`max_queued_disk_bytes` is the maximum number of bytes, to be written to disk, that can wait in the disk I/O thread queue. This queue is only for waiting for the disk I/O thread to receive the job and either write it to disk or insert it in the write cache. When this limit is reached, the peer connections will stop reading data from their sockets, until the disk thread catches up. Setting this too low will severely limit your download rate.

handshake_timeout | 27 | the number of seconds to wait for a handshake response from a peer. If no response is received within this time, the peer is disconnected.

send_buffer_low_watermark

28

`send_buffer_low_watermark` the minimum send buffer target size (send buffer includes bytes pending being read from disk). For good and snappy seeding performance, set this fairly high, to at least fit a few blocks. This is essentially the initial window size which will determine how fast we can ramp up the send rate

if the send buffer has fewer bytes than `send_buffer_watermark`, we'll read another 16kB block onto it. If set too small, upload rate capacity will suffer. If set too high, memory will be wasted. The actual watermark may be lower than this in case the upload rate is low, this is the upper limit.

the current upload rate to a peer is multiplied by this factor to get the send buffer watermark. The factor is specified as a percentage. i.e. 50 -> 0.5 This product is clamped to the `send_buffer_watermark` setting to not exceed the max. For high speed upload, this should be set to a greater value than 100. For high capacity connections, setting this higher can improve upload performance and disk throughput. Setting it too high may waste RAM and create a bias towards read jobs over write jobs.

send_buffer_watermark | 29 |
send_buffer_watermark_factor | 30 |

choking_algorithm

31

`choking_algorithm` specifies which algorithm to use to determine which peers to unchoke.

The options for choking algorithms are:

- `fixed_slots_choker` is the traditional choker with a fixed number of unchoke slots (as specified by `settings_pack::unchoke_slots_limit`).
- `rate_based_choker` opens up unchoke slots based on the upload rate achieved to peers. The more slots that are opened, the marginal upload rate required to open up another slot increases.
- `bittyrant_choker` attempts to optimize download rate by finding the reciprocation rate of each peer individually and prefers peers that gives the highest return on investment. It still allocates all upload capacity, but shuffles it around to the best peers first. For this choker to be efficient, you need to set a global upload rate limit (`settings_pack::upload_rate_limit`). For more information about this choker, see the paper. This choker is not fully implemented nor tested.

`seed_choking_algorithm` controls the seeding unchoke behavior. The available options are:

- `round_robin` which round-robins the peers that are unchoked when seeding. This distributes the upload bandwidht uniformly and fairly. It minimizes the ability for a peer to download everything without redistributing it.
- `fastest_upload` unchokes the peers we can send to the fastest. This might be a bit more reliable in utilizing all available capacity.
- `anti_leech` prioritizes peers who have just started or are just about to finish the download. The intention is to force peers in the middle of the download to trade with each other.

seed_choking_algorithm | 32 |

cache_size

33

`cache_size` is the disk write and read cache. It is specified in units of 16 KiB blocks. Buffers that are part of a peer's send or receive buffer also count against this limit. Send and receive buffers will never be denied to be allocated, but they will cause the actual cached blocks to be flushed or evicted. If this is set to -1, the cache size is automatically set to the amount of physical RAM available in the machine divided by 8. If the amount of physical RAM cannot be determined, it's set to 1024 (= 16 MiB).

Disk buffers are allocated using a pool allocator, the number of blocks that are allocated at a time when the pool needs to grow can be specified in `cache_buffer_chunk_size`. Lower numbers saves memory at the expense of more heap allocations. If it is set to 0, the effective chunk size is proportional to the total cache size, attempting to strike a good balance between performance and memory usage. It defaults to 0. `cache_expiry` is the number of seconds from the last cached write to a piece in the write cache, to when it's forcefully flushed to disk. Default is 60 second.

On 32 bit builds, the effective cache size will be limited to 3/4 of 2 GiB to avoid exceeding the virtual address space limit.

cache_buffer_chunk_size | 34 |
cache_expiry | 35 |
deprecated11 | 36 |

disk_io_write_mode

37

determines how files are opened when they're in read only mode versus read and write mode. The options are:

enable_os_cache
  This is the default and files are opened normally, with the OS caching reads and writes.
disable_os_cache
  This opens all files in no-cache mode. This corresponds to the OS not letting blocks for the files linger in the cache. This makes sense in order to avoid the bittorrent client to potentially evict all other processes' cache by simply handling high throughput and large files. If libtorrent's read cache is disabled, enabling this may reduce performance.

One reason to disable caching is that it may help the operating system from growing its file cache indefinitely.

disk_io_read_mode | 38 |

outgoing_port

39

this is the first port to use for binding outgoing connections to. This is useful for users that have routers that allow QoS settings based on local port. when binding outgoing connections to specific ports, `num_outgoing_ports` is the size of the range. It should be more than a few

Warning

setting outgoing ports will limit the ability to keep multiple connections to the same client, even for different torrents. It is not recommended to change this setting. Its main purpose is to use as an escape hatch for cheap routers with QoS capability but can only classify flows based on port numbers.

It is a range instead of a single port because of the problems with failing to reconnect to peers if a previous socket to that peer and port is in `TIME_WAIT` state.

num_outgoing_ports | 40 |
peer_tos | 41 | `peer_tos` determines the TOS byte set in the IP header of every packet sent to peers (including web seeds). The default value for this is `0x0` (no marking). One potentially useful TOS mark is `0x20`, this represents the QBone scavenger service. For more details, see QBSS.

active_downloads

42

for auto managed torrents, these are the limits they are subject to. If there are too many torrents some of the auto managed ones will be paused until some slots free up. `active_downloads` and `active_seeds` controls how many active seeding and downloading torrents the queuing mechanism allows. The target number of active torrents is `min(active_downloads + active_seeds, active_limit)`. `active_downloads` and `active_seeds` are upper limits on the number of downloading torrents and seeding torrents respectively. Setting the value to -1 means unlimited.

For example if there are 10 seeding torrents and 10 downloading torrents, and `active_downloads` is 4 and `active_seeds` is 4, there will be 4 seeds active and 4 downloading torrents. If the settings are `active_downloads` = 2 and `active_seeds` = 4, then there will be 2 downloading torrents and 4 seeding torrents active. Torrents that are not auto managed are not counted against these limits.

`active_checking` is the limit of number of simultaneous checking torrents.

`active_limit` is a hard limit on the number of active (auto managed) torrents. This limit also applies to slow torrents.

`active_dht_limit` is the max number of torrents to announce to the DHT. By default this is set to 88, which is no more than one DHT announce every 10 seconds.

`active_tracker_limit` is the max number of torrents to announce to their trackers. By default this is 360, which is no more than one announce every 5 seconds.

`active_lsd_limit` is the max number of torrents to announce to the local network over the local service discovery protocol. By default this is 80, which is no more than one announce every 5 seconds (assuming the default announce interval of 5 minutes).

You can have more torrents active, even though they are not announced to the DHT, lsd or their tracker. If some peer knows about you for any reason and tries to connect, it will still be accepted, unless the torrent is paused, which means it won't accept any connections.

`active_loaded_limit` is the number of torrents that are allowed to be loaded at any given time. Note that a torrent can be active even though it's not loaded. If an unloaded torrents finds a peer that wants to access it, the torrent will be loaded on demand, using a user-supplied callback function. If the feature of unloading torrents is not enabled, this setting have no effect. If this limit is set to 0, it means unlimited. For more information, see dynamic loading of torrent files.

active_seeds | 43 |
active_checking | 44 |
active_dht_limit | 45 |
active_tracker_limit | 46 |
active_lsd_limit | 47 |
active_limit | 48 |
active_loaded_limit | 49 |
auto_manage_interval | 50 | `auto_manage_interval` is the number of seconds between the torrent queue is updated, and rotated.
seed_time_limit | 51 | this is the limit on the time a torrent has been an active seed (specified in seconds) before it is considered having met the seed limit criteria. See queuing.

auto_scrape_interval

52

`auto_scrape_interval` is the number of seconds between scrapes of queued torrents (auto managed and paused torrents). Auto managed torrents that are paused, are scraped regularly in order to keep track of their downloader/seed ratio. This ratio is used to determine which torrents to seed and which to pause.

`auto_scrape_min_interval` is the minimum number of seconds between any automatic scrape (regardless of torrent). In case there are a large number of paused auto managed torrents, this puts a limit on how often a scrape request is sent.

auto_scrape_min_interval | 53 |

max_peerlist_size

54

`max_peerlist_size` is the maximum number of peers in the list of known peers. These peers are not necessarily connected, so this number should be much greater than the maximum number of connected peers. Peers are evicted from the cache when the list grows passed 90% of this limit, and once the size hits the limit, peers are no longer added to the list. If this limit is set to 0, there is no limit on how many peers we'll keep in the peer list.

`max_paused_peerlist_size` is the max peer list size used for torrents that are paused. This default to the same as `max_peerlist_size`, but can be used to save memory for paused torrents, since it's not as important for them to keep a large peer list.

max_paused_peerlist_size | 55 |
min_announce_interval | 56 | this is the minimum allowed announce interval for a tracker. This is specified in seconds and is used as a sanity check on what is returned from a tracker. It mitigates hammering misconfigured trackers.
auto_manage_startup | 57 | this is the number of seconds a torrent is considered active after it was started, regardless of upload and download speed. This is so that newly started torrents are not considered inactive until they have a fair chance to start downloading.
seeding_piece_quota | 58 | `seeding_piece_quota` is the number of pieces to send to a peer, when seeding, before rotating in another peer to the unchoke set. It defaults to 3 pieces, which means that when seeding, any peer we've sent more than this number of pieces to will be unchoked in favour of a choked peer.
max_rejects | 59 | TODO: deprecate this `max_rejects` is the number of piece requests we will reject in a row while a peer is choked before the peer is considered abusive and is disconnected.
recv_socket_buffer_size | 60 | `recv_socket_buffer_size` and `send_socket_buffer_size` specifies the buffer sizes set on peer sockets. 0 (which is the default) means the OS default (i.e. don't change the buffer sizes). The socket buffer sizes are changed using setsockopt() with SOL_SOCKET/SO_RCVBUF and SO_SNDBUFFER.
send_socket_buffer_size | 61 |
deprecated14 | 62 |

read_cache_line_size

63

`read_cache_line_size` is the number of blocks to read into the read cache when a read cache miss occurs. Setting this to 0 is essentially the same thing as disabling read cache. The number of blocks read into the read cache is always capped by the piece boundary.

When a piece in the write cache has `write_cache_line_size` contiguous blocks in it, they will be flushed. Setting this to 1 effectively disables the write cache.

write_cache_line_size | 64 |
optimistic_disk_retry | 65 | `optimistic_disk_retry` is the number of seconds from a disk write errors occur on a torrent until libtorrent will take it out of the upload mode, to test if the error condition has been fixed. libtorrent will only do this automatically for auto managed torrents. You can explicitly take a torrent out of upload only mode using set_upload_mode().
max_suggest_pieces | 66 | `max_suggest_pieces` is the max number of suggested piece indices received from a peer that's remembered. If a peer floods suggest messages, this limit prevents libtorrent from using too much RAM. It defaults to 10.
local_service_announce_interval | 67 | `local_service_announce_interval` is the time between local network announces for a torrent. By default, when local service discovery is enabled a torrent announces itself every 5 minutes. This interval is specified in seconds.
dht_announce_interval | 68 | `dht_announce_interval` is the number of seconds between announcing torrents to the distributed hash table (DHT).
udp_tracker_token_expiry | 69 | `udp_tracker_token_expiry` is the number of seconds libtorrent will keep UDP tracker connection tokens around for. This is specified to be 60 seconds, and defaults to that. The higher this value is, the fewer packets have to be sent to the UDP tracker. In order for higher values to work, the tracker needs to be configured to match the expiration time for tokens.
default_cache_min_age | 70 | `default_cache_min_age` is the minimum number of seconds any read cache line is kept in the cache. This defaults to one second but may be greater if `guided_read_cache` is enabled. Having a lower bound on the time a cache line stays in the cache is an attempt to avoid swapping the same pieces in and out of the cache in case there is a shortage of spare cache space.

num_optimistic_unchoke_slots

71

`num_optimistic_unchoke_slots` is the number of optimistic unchoke slots to use. It defaults to 0, which means automatic. Having a higher number of optimistic unchoke slots mean you will find the good peers faster but with the trade-off to use up more bandwidth. When this is set to 0, libtorrent opens up 20% of your allowed upload slots as optimistic unchoke slots.

default_est_reciprocation_rate

72

`default_est_reciprocation_rate` is the assumed reciprocation rate from peers when using the BitTyrant choker. This defaults to 14 kiB/s. If set too high, you will over-estimate your peers and be more altruistic while finding the true reciprocation rate, if it's set too low, you'll be too stingy and waste finding the true reciprocation rate.

`increase_est_reciprocation_rate` specifies how many percent the estimated reciprocation rate should be increased by each unchoke interval a peer is still choking us back. This defaults to 20%. This only applies to the BitTyrant choker.

`decrease_est_reciprocation_rate` specifies how many percent the estimated reciprocation rate should be decreased by each unchoke interval a peer unchokes us. This default to 3%. This only applies to the BitTyrant choker.

increase_est_reciprocation_rate | 73 |
decrease_est_reciprocation_rate | 74 |
max_pex_peers | 75 | the max number of peers we accept from pex messages from a single peer. this limits the number of concurrent peers any of our peers claims to be connected to. If they claim to be connected to more than this, we'll ignore any peer that exceeds this limit
tick_interval | 76 | `tick_interval` specifies the number of milliseconds between internal ticks. This is the frequency with which bandwidth quota is distributed to peers. It should not be more than one second (i.e. 1000 ms). Setting this to a low value (around 100) means higher resolution bandwidth quota distribution, setting it to a higher value saves CPU cycles.

share_mode_target

77

`share_mode_target` specifies the target share ratio for share mode torrents. This defaults to 3, meaning we'll try to upload 3 times as much as we download. Setting this very high, will make it very conservative and you might end up not downloading anything ever (and not affecting your share ratio). It does not make any sense to set this any lower than 2. For instance, if only 3 peers need to download the rarest piece, it's impossible to download a single piece and upload it more than 3 times. If the share_mode_target is set to more than 3, nothing is downloaded.

upload_rate_limit | 78 | `upload_rate_limit` and `download_rate_limit` sets the session-global limits of upload and download rate limits, in bytes per second. By default peers on the local network are not rate limited. A value of 0 means unlimited. For fine grained control over rate limits, including making them apply to local peers, see peer classes.
download_rate_limit | 79 |
deprecated3 | 80 |
deprecated4 | 81 |
dht_upload_rate_limit | 82 | `dht_upload_rate_limit` sets the rate limit on the DHT. This is specified in bytes per second and defaults to 4000. For busy boxes with lots of torrents that requires more DHT traffic, this should be raised.
unchoke_slots_limit | 83 | `unchoke_slots_limit` is the max number of unchoked peers in the session. The number of unchoke slots may be ignored depending on what `choking_algorithm` is set to.
deprecated5 | 84 |
connections_limit | 85 | `connections_limit` sets a global limit on the number of connections opened. The number of connections is set to a hard minimum of at least two per torrent, so if you set a too low connections limit, and open too many torrents, the limit will not be met.
connections_slack | 86 | `connections_slack` is the the number of incoming connections exceeding the connection limit to accept in order to potentially replace existing ones.

utp_target_delay

87

`utp_target_delay` is the target delay for uTP sockets in milliseconds. A high value will make uTP connections more aggressive and cause longer queues in the upload bottleneck. It cannot be too low, since the noise in the measurements would cause it to send too slow. The default is 50 milliseconds. `utp_gain_factor` is the number of bytes the uTP congestion window can increase at the most in one RTT. This defaults to 300 bytes. If this is set too high, the congestion controller reacts too hard to noise and will not be stable, if it's set too low, it will react slow to congestion and not back off as fast.

`utp_min_timeout` is the shortest allowed uTP socket timeout, specified in milliseconds. This defaults to 500 milliseconds. The timeout depends on the RTT of the connection, but is never smaller than this value. A connection times out when every packet in a window is lost, or when a packet is lost twice in a row (i.e. the resent packet is lost as well).

The shorter the timeout is, the faster the connection will recover from this situation, assuming the RTT is low enough. `utp_syn_resends` is the number of SYN packets that are sent (and timed out) before giving up and closing the socket. `utp_num_resends` is the number of times a packet is sent (and lossed or timed out) before giving up and closing the connection. `utp_connect_timeout` is the number of milliseconds of timeout for the initial SYN packet for uTP connections. For each timed out packet (in a row), the timeout is doubled. `utp_loss_multiplier` controls how the congestion window is changed when a packet loss is experienced. It's specified as a percentage multiplier for `cwnd`. By default it's set to 50 (i.e. cut in half). Do not change this value unless you know what you're doing. Never set it higher than 100.

utp_gain_factor | 88 |
utp_min_timeout | 89 |
utp_syn_resends | 90 |
utp_fin_resends | 91 |
utp_num_resends | 92 |
utp_connect_timeout | 93 |
deprecated6 | 94 |
utp_loss_multiplier | 95 |

mixed_mode_algorithm

96

The `mixed_mode_algorithm` determines how to treat TCP connections when there are uTP connections. Since uTP is designed to yield to TCP, there's an inherent problem when using swarms that have both TCP and uTP connections. If nothing is done, uTP connections would often be starved out for bandwidth by the TCP connections. This mode is `prefer_tcp`. The `peer_proportional` mode simply looks at the current throughput and rate limits all TCP connections to their proportional share based on how many of the connections are TCP. This works best if uTP connections are not rate limited by the global rate limiter (which they aren't by default).

listen_queue_size

97

`listen_queue_size` is the value passed in to listen() for the listen socket. It is the number of outstanding incoming connections to queue up while we're not actively waiting for a connection to be accepted. The default is 5 which should be sufficient for any normal client. If this is a high performance server which expects to receive a lot of connections, or used in a simulator or test, it might make sense to raise this number. It will not take affect until the `listen_interfaces` settings is updated.

torrent_connect_boost

98

`torrent_connect_boost` is the number of peers to try to connect to immediately when the first tracker response is received for a torrent. This is a boost to given to new torrents to accelerate them starting up. The normal connect scheduler is run once every second, this allows peers to be connected immediately instead of waiting for the session tick to trigger connections. This may not be set higher than 255.

alert_queue_size | 99 | `alert_queue_size` is the maximum number of alerts queued up internally. If alerts are not popped, the queue will eventually fill up to this level.
max_metadata_size | 100 | `max_metadata_size` is the maximum allowed size (in bytes) to be received by the metadata extension, i.e. magnet links.
deprecated9 | 101 |
checking_mem_usage | 102 | the number of blocks to keep outstanding at any given time when checking torrents. Higher numbers give faster re-checks but uses more memory. Specified in number of 16 kiB blocks
predictive_piece_announce | 103 | if set to > 0, pieces will be announced to other peers before they are fully downloaded (and before they are hash checked). The intention is to gain 1.5 potential round trip times per downloaded piece. When non-zero, this indicates how many milliseconds in advance pieces should be announced, before they are expected to be completed.
aio_threads | 104 | for some aio back-ends, `aio_threads` specifies the number of io-threads to use, and `aio_max` the max number of outstanding jobs.
aio_max | 105 |

network_threads

106

`network_threads` is the number of threads to use to call `async_write_some` (i.e. send) on peer connection sockets. When seeding at extremely high rates, this may become a bottleneck, and setting this to 2 or more may parallelize that cost. When using SSL torrents, all encryption for outgoing traffic is done within the socket send functions, and this will help parallelizing the cost of SSL encryption as well.

ssl_listen | 107 | `ssl_listen` sets the listen port for SSL connections. If this is set to 0, no SSL listen port is opened. Otherwise a socket is opened on this port. This setting is only taken into account when opening the regular listen port, and won't re-open the listen socket simply by changing this setting.

tracker_backoff

108

`tracker_backoff` determines how aggressively to back off from retrying failing trackers. This value determines x in the following formula, determining the number of seconds to wait until the next retry:

> delay = 5 + 5 * x / 100 * fails^2

This setting may be useful to make libtorrent more or less aggressive in hitting trackers.

share_ratio_limit

109

when a seeding torrent reaches either the share ratio (bytes up / bytes down) or the seed time ratio (seconds as seed / seconds as downloader) or the seed time limit (seconds as seed) it is considered done, and it will leave room for other torrents. These are specified as percentages. Torrents that are considered done will still be allowed to be seeded, they just won't have priority anymore. For more, see queuing.

seed_time_ratio_limit | 110 |

peer_turnover

111

peer_turnover is the percentage of peers to disconnect every turnover peer_turnover_interval (if we're at the peer limit), this is specified in percent when we are connected to more than limit * peer_turnover_cutoff peers disconnect peer_turnover fraction of the peers. It is specified in percent peer_turnover_interval is the interval (in seconds) between optimistic disconnects if the disconnects happen and how many peers are disconnected is controlled by peer_turnover and peer_turnover_cutoff

peer_turnover_cutoff | 112 |
peer_turnover_interval | 113 |

connect_seed_every_n_download

114

this setting controls the priority of downloading torrents over seeding or finished torrents when it comes to making peer connections. Peer connections are throttled by the connection_speed and the half-open connection limit. This makes peer connections a limited resource. Torrents that still have pieces to download are prioritized by default, to avoid having many seeding torrents use most of the connection attempts and only give one peer every now and then to the downloading torrent. libtorrent will loop over the downloading torrents to connect a peer each, and every n:th connection attempt, a finished torrent is picked to be allowed to connect to a peer. This setting controls n.

max_http_recv_buffer_size | 115 | the max number of bytes to allow an HTTP response to be when announcing to trackers or downloading .torrent files via the `url` provided in `add_torrent_params`.
max_retry_port_bind | 116 | if binding to a specific port fails, should the port be incremented by one and tried again? This setting specifies how many times to retry a failed port bind
alert_mask | 117 | a bitmask combining flags from alert::category_t defining which kinds of alerts to receive

out_enc_policy

118

control the settings for incoming and outgoing connections respectively. see enc_policy enum for the available options. Keep in mind that protocol encryption degrades performance in several respects:

1. It prevents "zero copy" disk buffers being sent to peers, since each peer needs to mutate the data (i.e. encrypt it) the data must be copied per peer connection rather than sending the same buffer to multiple peers.
2. The encryption itself requires more CPU than plain bittorrent protocol. The highest cost is the Diffie Hellman exchange on connection setup.
3. The encryption handshake adds several round-trips to the connection setup, and delays transferring data.

in_enc_policy | 119 |
allowed_enc_level | 120 | determines the encryption level of the connections. This setting will adjust which encryption scheme is offered to the other peer, as well as which encryption scheme is selected by the client. See enc_level enum for options.

inactive_down_rate

121

the download and upload rate limits for a torrent to be considered active by the queuing mechanism. A torrent whose download rate is less than `inactive_down_rate` and whose upload rate is less than `inactive_up_rate` for `auto_manage_startup` seconds, is considered inactive, and another queued torrent may be started. This logic is disabled if `dont_count_slow_torrents` is false.

inactive_up_rate | 122 |
proxy_type | 123 | proxy to use, defaults to none. see proxy_type_t.
proxy_port | 124 | the port of the proxy server
i2p_port | 125 | sets the i2p SAM bridge port to connect to. set the hostname with the `i2p_hostname` setting.

cache_size_volatile

126

this determines the max number of volatile disk cache blocks. If the number of volatile blocks exceed this limit, other volatile blocks will start to be evicted. A disk cache block is volatile if it has low priority, and should be one of the first blocks to be evicted under pressure. For instance, blocks pulled into the cache as the result of calculating a piece hash are volatile. These blocks don't represent potential interest among peers, so the value of keeping them in the cache is limited.

urlseed_max_request_bytes

127

The maximum request range of an url seed in bytes. This value defines the largest possible sequential web seed request. Default is 16 * 1024 * 1024. Lower values are possible but will be ignored if they are lower then piece size. This value should be related to your download speed to prevent libtorrent from creating too many expensive http requests per second. You can select a value as high as you want but keep in mind that libtorrent can't create parallel requests if the first request did already select the whole file. If you combine bittorrent seeds with web seeds and pick strategies like rarest first you may find your web seed requests split into smaller parts because we don't download already picked pieces twice.

web_seed_name_lookup_retry | 128 | time to wait until a new retry of a web seed name lookup

close_file_interval

129

the number of seconds between closing the file opened the longest ago. 0 means to disable the feature. The purpose of this is to periodically close files to trigger the operating system flushing disk cache. Specifically it has been observed to be required on windows to not have the disk cache grow indefinitely. This defaults to 120 seconds on windows, and disabled on other systems.

utp_cwnd_reduce_timer | 130 | When uTP experiences packet loss, it will reduce the congestion window, and not reduce it again for this many milliseconds, even if experiencing another lost packet.
max_int_setting_internal | 131 |

### enum settings_counts_t

Declared in "libtorrent/settings_pack.hpp"

name | value | description
--- | --- | ---
num_string_settings |  |
num_bool_settings |  |
num_int_settings |  |

### enum suggest_mode_t

Declared in "libtorrent/settings_pack.hpp"

name | value | description
--- | --- | ---
no_piece_suggestions | 0 |
suggest_read_cache | 1 |

### enum choking_algorithm_t

Declared in "libtorrent/settings_pack.hpp"

name | value | description
--- | --- | ---
fixed_slots_choker | 0 |
rate_based_choker | 2 |
bittyrant_choker | 3 |

### enum seed_choking_algorithm_t

Declared in "libtorrent/settings_pack.hpp"

name | value | description
--- | --- | ---
round_robin | 0 |
fastest_upload | 1 |
anti_leech | 2 |

### enum io_buffer_mode_t

Declared in "libtorrent/settings_pack.hpp"

name | value | description
--- | --- | ---
enable_os_cache | 0 |
deprecated | 1 |
disable_os_cache | 2 |

### enum bandwidth_mixed_algo_t

Declared in "libtorrent/settings_pack.hpp"

name | value | description
--- | --- | ---
prefer_tcp | 0 | disables the mixed mode bandwidth balancing
peer_proportional | 1 | does not throttle uTP, throttles TCP to the same proportion of throughput as there are TCP connections

### enum enc_policy

Declared in "libtorrent/settings_pack.hpp"

name | value | description
--- | --- | ---
pe_forced | 0 | Only encrypted connections are allowed. Incoming connections that are not encrypted are closed and if the encrypted outgoing connection fails, a non-encrypted retry will not be made.
pe_enabled | 1 | encrypted connections are enabled, but non-encrypted connections are allowed. An incoming non-encrypted connection will be accepted, and if an outgoing encrypted connection fails, a non- encrypted connection will be tried.
pe_disabled | 2 | only non-encrypted connections are allowed.

### enum enc_level

Declared in "libtorrent/settings_pack.hpp"

name | value | description
--- | --- | ---
pe_plaintext | 1 | use only plaintext encryption
pe_rc4 | 2 | use only rc4 encryption
pe_both | 3 | allow both

### enum proxy_type_t

Declared in "libtorrent/settings_pack.hpp"

name | value | description
--- | --- | ---
none | 0 | This is the default, no proxy server is used, all other fields are ignored.
socks4 | 1 | The server is assumed to be a SOCKS4 server that requires a username.
socks5 | 2 | The server is assumed to be a SOCKS5 server (RFC 1928) that does not require any authentication. The username and password are ignored.
socks5_pw | 3 | The server is assumed to be a SOCKS5 server that supports plain text username and password authentication (RFC 1929). The username and password specified may be sent to the proxy if it requires.
http | 4 | The server is assumed to be an HTTP proxy. If the transport used for the connection is non-HTTP, the server is assumed to support the CONNECT method. i.e. for web seeds and HTTP trackers, a plain proxy will suffice. The proxy is assumed to not require authorization. The username and password will not be used.
http_pw | 5 | The server is assumed to be an HTTP proxy that requires user authorization. The username and password will be sent to the proxy.
i2p_proxy | 6 | route through a i2p SAM proxy

## min_memory_usage() high_performance_seed()

Declared in "libtorrent/session.hpp"

    void min_memory_usage (settings_pack& set);
    void high_performance_seed (settings_pack& set);

The default values of the session settings are set for a regular bittorrent client running on a desktop system. There are functions that can set the session settings to pre set settings for other environments. These can be used for the basis, and should be tweaked to fit your needs better.

`min_memory_usage` returns settings that will use the minimal amount of RAM, at the potential expense of upload and download performance. It adjusts the socket buffer sizes, disables the disk cache, lowers the send buffer watermarks so that each connection only has at most one block in use at any one time. It lowers the outstanding blocks send to the disk I/O thread so that connections only have one block waiting to be flushed to disk at any given time. It lowers the max number of peers in the peer list for torrents. It performs multiple smaller reads when it hashes pieces, instead of reading it all into memory before hashing.

This configuration is inteded to be the starting point for embedded devices. It will significantly reduce memory usage.

`high_performance_seed` returns settings optimized for a seed box, serving many peers and that doesn't do any downloading. It has a 128 MB disk cache and has a limit of 400 files in its file pool. It support fast upload rates by allowing large send buffers.

## setting_by_name() name_for_setting()

Declared in "libtorrent/settings_pack.hpp"

    char const* name_for_setting (int s);
    int setting_by_name (std::string const& name);

## default_settings()

Declared in "libtorrent/settings_pack.hpp"

    settings_pack default_settings ();

returns a settings_pack with every setting set to its default value