3342
4069
If ``rate_limit_ip_overhead`` is set to true, the estimated TCP/IP overhead is
3343
4070
drained from the rate limiters, to avoid exceeding the limits with the total traffic
4072
``announce_to_all_trackers`` controls how multi tracker torrents are
4073
treated. If this is set to true, all trackers in the same tier are
4074
announced to in parallel. If all trackers in tier 0 fails, all trackers
4075
in tier 1 are announced as well. If it's set to false, the behavior is as
4076
defined by the multi tracker specification. It defaults to false, which
4077
is the same behavior previous versions of libtorrent has had as well.
4079
``announce_to_all_tiers`` also controls how multi tracker torrents are
4080
treated. When this is set to true, one tracker from each tier is announced
4081
to. This is the uTorrent behavior. This is false by default in order
4082
to comply with the multi-tracker specification.
4084
``prefer_udp_trackers`` is true by default. It means that trackers may
4085
be rearranged in a way that udp trackers are always tried before http
4086
trackers for the same hostname. Setting this to fails means that the
4087
trackers' tier is respected and there's no preference of one protocol
4090
``strict_super_seeding`` when this is set to true, a piece has to
4091
have been forwarded to a third peer before another one is handed out.
4092
This is the traditional definition of super seeding.
4094
``seeding_piece_quota`` is the number of pieces to send to a peer,
4095
when seeding, before rotating in another peer to the unchoke set.
4096
It defaults to 3 pieces, which means that when seeding, any peer we've
4097
sent more than this number of pieces to will be unchoked in favour of
4100
``max_sparse_regions`` is a limit of the number of *sparse regions* in
4101
a torrent. A sparse region is defined as a hole of pieces we have not
4102
yet downloaded, in between pieces that have been downloaded. This is
4103
used as a hack for windows vista which has a bug where you cannot
4104
write files with more than a certain number of sparse regions. This
4105
limit is not hard, it will be exceeded. Once it's exceeded, pieces
4106
that will maintain or decrease the number of sparse regions are
4107
prioritized. To disable this functionality, set this to 0. It defaults
4108
to 0 on all platforms except windows.
4110
``lock_disk_cache`` if lock disk cache is set to true the disk cache
4111
that's in use, will be locked in physical memory, preventing it from
4114
``max_rejects`` is the number of piece requests we will reject in a row
4115
while a peer is choked before the peer is considered abusive and is
4119
``recv_socket_buffer_size`` and ``send_socket_buffer_size`` specifies
4120
the buffer sizes set on peer sockets. 0 (which is the default) means
4121
the OS default (i.e. don't change the buffer sizes). The socket buffer
4122
sizes are changed using setsockopt() with SOL_SOCKET/SO_RCVBUF and
4125
``optimize_hashing_for_speed`` chooses between two ways of reading back
4126
piece data from disk when its complete and needs to be verified against
4127
the piece hash. This happens if some blocks were flushed to the disk
4128
out of order. Everything that is flushed in order is hashed as it goes
4129
along. Optimizing for speed will allocate space to fit all the the
4130
remaingin, unhashed, part of the piece, reads the data into it in a single
4131
call and hashes it. This is the default. If ``optimizing_hashing_for_speed``
4132
is false, a single block will be allocated (16 kB), and the unhashed parts
4133
of the piece are read, one at a time, and hashed in this single block. This
4134
is appropriate on systems that are memory constrained.
4136
``file_checks_delay_per_block`` is the number of milliseconds to sleep
4137
in between disk read operations when checking torrents. This defaults
4138
to 0, but can be set to higher numbers to slow down the rate at which
4139
data is read from the disk while checking. This may be useful for
4140
background tasks that doesn't matter if they take a bit longer, as long
4141
as they leave disk I/O time for other processes.
4143
``disk_cache_algorithm`` tells the disk I/O thread which cache flush
4144
algorithm to use. The default algorithm is largest_contiguous. This
4145
flushes the entire piece, in the write cache, that was least recently
4146
written to. This is specified by the ``session_settings::lru`` enum
4147
value. ``session_settings::largest_contiguous`` will flush the largest
4148
sequences of contiguous blocks from the write cache, regarless of the
4149
piece's last use time.
4151
``read_cache_line_size`` is the number of blocks to read into the read
4152
cache when a read cache miss occurs. Setting this to 0 is essentially
4153
the same thing as disabling read cache. The number of blocks read
4154
into the read cache is always capped by the piece boundry.
4156
When a piece in the write cache has ``write_cache_line_size`` contiguous
4157
blocks in it, they will be flushed. Setting this to 1 effectively
4158
disables the write cache.
4160
``optimistic_disk_retry`` is the number of seconds from a disk write
4161
errors occur on a torrent until libtorrent will take it out of the
4162
upload mode, to test if the error condition has been fixed.
4164
libtorrent will only do this automatically for auto managed torrents.
4166
You can explicitly take a torrent out of upload only mode using
4167
`set_upload_mode()`_.
4169
``disable_hash_check`` controls if downloaded pieces are verified against
4170
the piece hashes in the torrent file or not. The default is false, i.e.
4171
to verify all downloaded data. It may be useful to turn this off for performance
4172
profiling and simulation scenarios. Do not disable the hash check for regular
4175
``max_suggest_pieces`` is the max number of suggested piece indices received
4176
from a peer that's remembered. If a peer floods suggest messages, this limit
4177
prevents libtorrent from using too much RAM. It defaults to 10.
4179
If ``drop_skipped_requests`` is set to true (it defaults to false), piece
4180
requests that have been skipped enough times when piece messages
4181
are received, will be considered lost. Requests are considered skipped
4182
when the returned piece messages are re-ordered compared to the order
4183
of the requests. This was an attempt to get out of dead-locks caused by
4184
BitComet peers silently ignoring some requests. It may cause problems
4185
at high rates, and high level of reordering in the uploading peer, that's
4186
why it's disabled by default.
4188
``low_prio_disk`` determines if the disk I/O should use a normal
4189
or low priority policy. This defaults to true, which means that
4190
it's low priority by default. Other processes doing disk I/O will
4191
normally take priority in this mode. This is meant to improve the
4192
overall responsiveness of the system while downloading in the
4193
background. For high-performance server setups, this might not
4196
``local_service_announce_interval`` is the time between local
4197
network announces for a torrent. By default, when local service
4198
discovery is enabled a torrent announces itself every 5 minutes.
4199
This interval is specified in seconds.
4201
``udp_tracker_token_expiry`` is the number of seconds libtorrent
4202
will keep UDP tracker connection tokens around for. This is specified
4203
to be 60 seconds, and defaults to that. The higher this value is, the
4204
fewer packets have to be sent to the UDP tracker. In order for higher
4205
values to work, the tracker needs to be configured to match the
4206
expiration time for tokens.
4208
When ``report_true_downloaded`` is true, the ``&downloaded=`` argument
4209
sent to trackers will include redundant downloaded bytes. It defaults
4210
to ``false``, which means redundant bytes are not reported to the tracker.
4212
``strict_end_game_mode`` defaults to true, and controls when a block
4213
may be requested twice. If this is ``true``, a block may only be requested
4214
twice when there's ay least one request to every piece that's left to
4215
download in the torrent. This may slow down progress on some pieces
4216
sometimes, but it may also avoid downloading a lot of redundant bytes.
4217
If this is ``false``, libtorrent attempts to use each peer connection
4218
to its max, by always requesting something, even if it means requesting
4219
something that has been requested from another peer already.
4644
There are a number of exceptions that can be thrown from different places in libtorrent,
4645
here's a complete list with description.
4651
This exception is thrown when querying information from a torrent_handle_ that hasn't
4652
been initialized or that has become invalid.
4656
struct invalid_handle: std::exception
4658
const char* what() const throw();
4665
This is thrown by `add_torrent()`_ if the torrent already has been added to
4666
the session. Since `remove_torrent()`_ is asynchronous, this exception may
4667
be thrown if the torrent is removed and then immediately added again.
4671
struct duplicate_torrent: std::exception
4673
const char* what() const throw();
4680
This is thrown by ``bdecode()`` if the input data is not a valid bencoding.
4684
struct invalid_encoding: std::exception
4686
const char* what() const throw();
4693
This is thrown from the accessors of ``entry`` if the data type of the ``entry`` doesn't
4694
match the type you want to extract from it.
4698
struct type_error: std::runtime_error
4700
type_error(const char* error);
4704
invalid_torrent_file
5894
Many functions in libtorrent have two versions, one that throws exceptions on
5895
errors and one that takes an ``error_code`` reference which is filled with the
5896
error code on errors.
5898
There is one exception class that is used for errors in libtorrent, it is based
5899
on boost.system's ``error_code`` class to carry the error code.
5901
libtorrent_exception
4705
5902
--------------------
4707
This exception is thrown from the constructor of ``torrent_info`` if the given bencoded information
4708
doesn't meet the requirements on what information has to be present in a torrent file.
4712
struct invalid_torrent_file: std::exception
5906
struct libtorrent_exception: std::exception
4714
const char* what() const throw();
5908
libtorrent_exception(error_code const& s);
5909
virtual const char* what() const throw();
5910
virtual ~libtorrent_exception() throw() {}
5911
boost::system::error_code error() const;
5918
libtorrent uses boost.system's ``error_code`` class to represent errors. libtorrent has
5919
its own error category (``libtorrent::libtorrent_category``) whith the following error
5922
====== ========================================= =================================================================
5923
code symbol description
5924
====== ========================================= =================================================================
5925
0 no_error Not an error
5926
------ ----------------------------------------- -----------------------------------------------------------------
5927
1 file_collision Two torrents has files which end up overwriting each other
5928
------ ----------------------------------------- -----------------------------------------------------------------
5929
2 failed_hash_check A piece did not match its piece hash
5930
------ ----------------------------------------- -----------------------------------------------------------------
5931
3 torrent_is_no_dict The .torrent file does not contain a bencoded dictionary at
5933
------ ----------------------------------------- -----------------------------------------------------------------
5934
4 torrent_missing_info The .torrent file does not have an ``info`` dictionary
5935
------ ----------------------------------------- -----------------------------------------------------------------
5936
5 torrent_info_no_dict The .torrent file's ``info`` entry is not a dictionary
5937
------ ----------------------------------------- -----------------------------------------------------------------
5938
6 torrent_missing_piece_length The .torrent file does not have a ``piece length`` entry
5939
------ ----------------------------------------- -----------------------------------------------------------------
5940
7 torrent_missing_name The .torrent file does not have a ``name`` entry
5941
------ ----------------------------------------- -----------------------------------------------------------------
5942
8 torrent_invalid_name The .torrent file's name entry is invalid
5943
------ ----------------------------------------- -----------------------------------------------------------------
5944
9 torrent_invalid_length The length of a file, or of the whole .torrent file is invalid.
5945
Either negative or not an integer
5946
------ ----------------------------------------- -----------------------------------------------------------------
5947
10 torrent_file_parse_failed Failed to parse a file entry in the .torrent
5948
------ ----------------------------------------- -----------------------------------------------------------------
5949
11 torrent_missing_pieces The ``pieces`` field is missing or invalid in the .torrent file
5950
------ ----------------------------------------- -----------------------------------------------------------------
5951
12 torrent_invalid_hashes The ``pieces`` string has incorrect length
5952
------ ----------------------------------------- -----------------------------------------------------------------
5953
13 too_many_pieces_in_torrent The .torrent file has more pieces than is supported by libtorrent
5954
------ ----------------------------------------- -----------------------------------------------------------------
5955
14 invalid_swarm_metadata The metadata (.torrent file) that was received from the swarm
5956
matched the info-hash, but failed to be parsed
5957
------ ----------------------------------------- -----------------------------------------------------------------
5958
15 invalid_bencoding The file or buffer is not correctly bencoded
5959
------ ----------------------------------------- -----------------------------------------------------------------
5960
16 no_files_in_torrent The .torrent file does not contain any files
5961
------ ----------------------------------------- -----------------------------------------------------------------
5962
17 invalid_escaped_string The string was not properly url-encoded as expected
5963
------ ----------------------------------------- -----------------------------------------------------------------
5964
18 session_is_closing Operation is not permitted since the session is shutting down
5965
------ ----------------------------------------- -----------------------------------------------------------------
5966
19 duplicate_torrent There's already a torrent with that info-hash added to the
5968
------ ----------------------------------------- -----------------------------------------------------------------
5969
20 invalid_torrent_handle The supplied torrent_handle is not referring to a valid torrent
5970
------ ----------------------------------------- -----------------------------------------------------------------
5971
21 invalid_entry_type The type requested from the entry did not match its type
5972
------ ----------------------------------------- -----------------------------------------------------------------
5973
22 missing_info_hash_in_uri The specified URI does not contain a valid info-hash
5974
------ ----------------------------------------- -----------------------------------------------------------------
5975
23 file_too_short One of the files in the torrent was unexpectadly small. This
5976
might be caused by files being changed by an external process
5977
------ ----------------------------------------- -----------------------------------------------------------------
5978
24 unsupported_url_protocol The URL used an unknown protocol. Currently ``http`` and
5979
``https`` (if built with openssl support) are recognized. For
5980
trackers ``udp`` is recognized as well.
5981
------ ----------------------------------------- -----------------------------------------------------------------
5982
25 url_parse_error The URL did not conform to URL syntax and failed to be parsed
5983
------ ----------------------------------------- -----------------------------------------------------------------
5984
26 peer_sent_empty_piece The peer sent a 'piece' message of length 0
5985
------ ----------------------------------------- -----------------------------------------------------------------
5986
27 parse_failed A bencoded structure was currupt and failed to be parsed
5987
------ ----------------------------------------- -----------------------------------------------------------------
5988
28 invalid_file_tag The fast resume file was missing or had an invalid file version
5990
------ ----------------------------------------- -----------------------------------------------------------------
5991
29 missing_info_hash The fast resume file was missing or had an invalid info-hash
5992
------ ----------------------------------------- -----------------------------------------------------------------
5993
30 mismatching_info_hash The info-hash in the resume file did not match the torrent
5994
------ ----------------------------------------- -----------------------------------------------------------------
5995
31 invalid_hostname The URL contained an invalid hostname
5996
------ ----------------------------------------- -----------------------------------------------------------------
5997
32 invalid_port The URL had an invalid port
5998
------ ----------------------------------------- -----------------------------------------------------------------
5999
33 port_blocked The port is blocked by the port-filter, and prevented the
6001
------ ----------------------------------------- -----------------------------------------------------------------
6002
34 expected_close_bracket_in_address The IPv6 address was expected to end with ']'
6003
------ ----------------------------------------- -----------------------------------------------------------------
6004
35 destructing_torrent The torrent is being destructed, preventing the operation to
6006
------ ----------------------------------------- -----------------------------------------------------------------
6007
36 timed_out The connection timed out
6008
------ ----------------------------------------- -----------------------------------------------------------------
6009
37 upload_upload_connection The peer is upload only, and we are upload only. There's no point
6010
in keeping the connection
6011
------ ----------------------------------------- -----------------------------------------------------------------
6012
38 uninteresting_upload_peer The peer is upload only, and we're not interested in it. There's
6013
no point in keeping the connection
6014
------ ----------------------------------------- -----------------------------------------------------------------
6015
39 invalid_info_hash The peer sent an unknown info-hash
6016
------ ----------------------------------------- -----------------------------------------------------------------
6017
40 torrent_paused The torrent is paused, preventing the operation from succeeding
6018
------ ----------------------------------------- -----------------------------------------------------------------
6019
41 invalid_have The peer sent an invalid have message, either wrong size or
6020
referring to a piece that doesn't exist in the torrent
6021
------ ----------------------------------------- -----------------------------------------------------------------
6022
42 invalid_bitfield_size The bitfield message had the incorrect size
6023
------ ----------------------------------------- -----------------------------------------------------------------
6024
43 too_many_requests_when_choked The peer kept requesting pieces after it was choked, possible
6026
------ ----------------------------------------- -----------------------------------------------------------------
6027
44 invalid_piece The peer sent a piece message that does not correspond to a
6028
piece request sent by the client
6029
------ ----------------------------------------- -----------------------------------------------------------------
6030
45 no_memory memory allocation failed
6031
------ ----------------------------------------- -----------------------------------------------------------------
6032
46 torrent_aborted The torrent is aborted, preventing the operation to succeed
6033
------ ----------------------------------------- -----------------------------------------------------------------
6034
47 self_connection The peer is a connection to ourself, no point in keeping it
6035
------ ----------------------------------------- -----------------------------------------------------------------
6036
48 invalid_piece_size The peer sent a piece message with invalid size, either negative
6037
or greater than one block
6038
------ ----------------------------------------- -----------------------------------------------------------------
6039
49 timed_out_no_interest The peer has not been interesting or interested in us for too
6040
long, no point in keeping it around
6041
------ ----------------------------------------- -----------------------------------------------------------------
6042
50 timed_out_inactivity The peer has not said anything in a long time, possibly dead
6043
------ ----------------------------------------- -----------------------------------------------------------------
6044
51 timed_out_no_handshake The peer did not send a handshake within a reasonable amount of
6045
time, it might not be a bittorrent peer
6046
------ ----------------------------------------- -----------------------------------------------------------------
6047
52 timed_out_no_request The peer has been unchoked for too long without requesting any
6048
data. It might be lying about its interest in us
6049
------ ----------------------------------------- -----------------------------------------------------------------
6050
53 invalid_choke The peer sent an invalid choke message
6051
------ ----------------------------------------- -----------------------------------------------------------------
6052
54 invalid_unchoke The peer send an invalid unchoke message
6053
------ ----------------------------------------- -----------------------------------------------------------------
6054
55 invalid_interested The peer sent an invalid interested message
6055
------ ----------------------------------------- -----------------------------------------------------------------
6056
56 invalid_not_interested The peer sent an invalid not-interested message
6057
------ ----------------------------------------- -----------------------------------------------------------------
6058
57 invalid_request The peer sent an invalid piece request message
6059
------ ----------------------------------------- -----------------------------------------------------------------
6060
58 invalid_hash_list The peer sent an invalid hash-list message (this is part of the
6061
merkle-torrent extension)
6062
------ ----------------------------------------- -----------------------------------------------------------------
6063
59 invalid_hash_piece The peer sent an invalid hash-piece message (this is part of the
6064
merkle-torrent extension)
6065
------ ----------------------------------------- -----------------------------------------------------------------
6066
60 invalid_cancel The peer sent an invalid cancel message
6067
------ ----------------------------------------- -----------------------------------------------------------------
6068
61 invalid_dht_port The peer sent an invalid DHT port-message
6069
------ ----------------------------------------- -----------------------------------------------------------------
6070
62 invalid_suggest The peer sent an invalid suggest piece-message
6071
------ ----------------------------------------- -----------------------------------------------------------------
6072
63 invalid_have_all The peer sent an invalid have all-message
6073
------ ----------------------------------------- -----------------------------------------------------------------
6074
64 invalid_have_none The peer sent an invalid have none-message
6075
------ ----------------------------------------- -----------------------------------------------------------------
6076
65 invalid_reject The peer sent an invalid reject message
6077
------ ----------------------------------------- -----------------------------------------------------------------
6078
66 invalid_allow_fast The peer sent an invalid allow fast-message
6079
------ ----------------------------------------- -----------------------------------------------------------------
6080
67 invalid_extended The peer sent an invalid extesion message ID
6081
------ ----------------------------------------- -----------------------------------------------------------------
6082
68 invalid_message The peer sent an invalid message ID
6083
------ ----------------------------------------- -----------------------------------------------------------------
6084
69 sync_hash_not_found The synchronization hash was not found in the encrypted handshake
6085
------ ----------------------------------------- -----------------------------------------------------------------
6086
70 invalid_encryption_constant The encryption constant in the handshake is invalid
6087
------ ----------------------------------------- -----------------------------------------------------------------
6088
71 no_plaintext_mode The peer does not support plaintext, which is the selected mode
6089
------ ----------------------------------------- -----------------------------------------------------------------
6090
72 no_rc4_mode The peer does not support rc4, which is the selected mode
6091
------ ----------------------------------------- -----------------------------------------------------------------
6092
73 unsupported_encryption_mode The peer does not support any of the encryption modes that the
6094
------ ----------------------------------------- -----------------------------------------------------------------
6095
74 unsupported_encryption_mode_selected The peer selected an encryption mode that the client did not
6096
advertise and does not support
6097
------ ----------------------------------------- -----------------------------------------------------------------
6098
75 invalid_pad_size The pad size used in the encryption handshake is of invalid size
6099
------ ----------------------------------------- -----------------------------------------------------------------
6100
76 invalid_encrypt_handshake The encryption handshake is invalid
6101
------ ----------------------------------------- -----------------------------------------------------------------
6102
77 no_incoming_encrypted The client is set to not support incoming encrypted connections
6103
and this is an encrypted connection
6104
------ ----------------------------------------- -----------------------------------------------------------------
6105
78 no_incoming_regular The client is set to not support incoming regular bittorrent
6106
connections, and this is a regular connection
6107
------ ----------------------------------------- -----------------------------------------------------------------
6108
79 duplicate_peer_id The client is already connected to this peer-ID
6109
------ ----------------------------------------- -----------------------------------------------------------------
6110
80 torrent_removed Torrent was removed
6111
------ ----------------------------------------- -----------------------------------------------------------------
6112
81 packet_too_large The packet size exceeded the upper sanity check-limit
6113
------ ----------------------------------------- -----------------------------------------------------------------
6115
------ ----------------------------------------- -----------------------------------------------------------------
6116
83 http_error The web server responded with an error
6117
------ ----------------------------------------- -----------------------------------------------------------------
6118
84 missing_location The web server response is missing a location header
6119
------ ----------------------------------------- -----------------------------------------------------------------
6120
85 invalid_redirection The web seed redirected to a path that no longer matches the
6121
.torrent directory structure
6122
------ ----------------------------------------- -----------------------------------------------------------------
6123
86 redirecting The connection was closed becaused it redirected to a different
6125
------ ----------------------------------------- -----------------------------------------------------------------
6126
87 invalid_range The HTTP range header is invalid
6127
------ ----------------------------------------- -----------------------------------------------------------------
6128
88 no_content_length The HTTP response did not have a content length
6129
------ ----------------------------------------- -----------------------------------------------------------------
6130
89 banned_by_ip_filter The IP is blocked by the IP filter
6131
------ ----------------------------------------- -----------------------------------------------------------------
6132
90 too_many_connections At the connection limit
6133
------ ----------------------------------------- -----------------------------------------------------------------
6134
91 peer_banned The peer is marked as banned
6135
------ ----------------------------------------- -----------------------------------------------------------------
6136
92 stopping_torrent The torrent is stopping, causing the operation to fail
6137
------ ----------------------------------------- -----------------------------------------------------------------
6138
93 too_many_corrupt_pieces The peer has sent too many corrupt pieces and is banned
6139
------ ----------------------------------------- -----------------------------------------------------------------
6140
94 torrent_not_ready The torrent is not ready to receive peers
6141
------ ----------------------------------------- -----------------------------------------------------------------
6142
95 peer_not_constructed The peer is not completely constructed yet
6143
------ ----------------------------------------- -----------------------------------------------------------------
6144
96 session_closing The session is closing, causing the operation to fail
6145
------ ----------------------------------------- -----------------------------------------------------------------
6146
97 optimistic_disconnect The peer was disconnected in order to leave room for a
6147
potentially better peer
6148
------ ----------------------------------------- -----------------------------------------------------------------
6149
98 torrent_finished The torrent is finished
6150
------ ----------------------------------------- -----------------------------------------------------------------
6151
99 no_router No UPnP router found
6152
------ ----------------------------------------- -----------------------------------------------------------------
6153
100 metadata_too_large The metadata message says the metadata exceeds the limit
6154
------ ----------------------------------------- -----------------------------------------------------------------
6155
101 invalid_metadata_request The peer sent an invalid metadata request message
6156
------ ----------------------------------------- -----------------------------------------------------------------
6157
102 invalid_metadata_size The peer advertised an invalid metadata size
6158
------ ----------------------------------------- -----------------------------------------------------------------
6159
103 invalid_metadata_offset The peer sent a message with an invalid metadata offset
6160
------ ----------------------------------------- -----------------------------------------------------------------
6161
104 invalid_metadata_message The peer sent an invalid metadata message
6162
------ ----------------------------------------- -----------------------------------------------------------------
6163
105 pex_message_too_large The peer sent a peer exchange message that was too large
6164
------ ----------------------------------------- -----------------------------------------------------------------
6165
106 invalid_pex_message The peer sent an invalid peer exchange message
6166
------ ----------------------------------------- -----------------------------------------------------------------
6167
107 invalid_lt_tracker_message The peer sent an invalid tracker exchange message
6168
====== ========================================= =================================================================
6172
====== ========================================= =================================================================
6173
code symbol description
6174
====== ========================================= =================================================================
6175
120 unsupported_protocol_version The NAT-PMP router responded with an unsupported protocol version
6176
------ ----------------------------------------- -----------------------------------------------------------------
6177
121 natpmp_not_authorized You are not authorized to map ports on this NAT-PMP router
6178
------ ----------------------------------------- -----------------------------------------------------------------
6179
122 network_failure The NAT-PMP router failed because of a network failure
6180
------ ----------------------------------------- -----------------------------------------------------------------
6181
123 no_resources The NAT-PMP router failed because of lack of resources
6182
------ ----------------------------------------- -----------------------------------------------------------------
6183
124 unsupported_opcode The NAT-PMP router failed because an unsupported opcode was sent
6184
====== ========================================= =================================================================
6186
fastresume data errors:
6188
====== ========================================= =================================================================
6189
code symbol description
6190
====== ========================================= =================================================================
6191
130 missing_file_sizes The resume data file is missing the 'file sizes' entry
6192
------ ----------------------------------------- -----------------------------------------------------------------
6193
131 no_files_in_resume_data The resume data file 'file sizes' entry is empty
6194
------ ----------------------------------------- -----------------------------------------------------------------
6195
132 missing_pieces The resume data file is missing the 'pieces' and 'slots' entry
6196
------ ----------------------------------------- -----------------------------------------------------------------
6197
133 mismatching_number_of_files The number of files in the resume data does not match the number
6198
of files in the torrent
6199
------ ----------------------------------------- -----------------------------------------------------------------
6200
134 mismatching_files_size One of the files on disk has a different size than in the fast
6202
------ ----------------------------------------- -----------------------------------------------------------------
6203
135 mismatching_file_timestamp One of the files on disk has a different timestamp than in the
6205
------ ----------------------------------------- -----------------------------------------------------------------
6206
136 not_a_dictionary The resume data file is not a dictionary
6207
------ ----------------------------------------- -----------------------------------------------------------------
6208
137 invalid_blocks_per_piece The 'blocks per piece' entry is invalid in the resume data file
6209
------ ----------------------------------------- -----------------------------------------------------------------
6210
138 missing_slots The resume file is missing the 'slots' entry, which is required
6211
for torrents with compact allocation
6212
------ ----------------------------------------- -----------------------------------------------------------------
6213
139 too_many_slots The resume file contains more slots than the torrent
6214
------ ----------------------------------------- -----------------------------------------------------------------
6215
140 invalid_slot_list The 'slot' entry is invalid in the resume data
6216
------ ----------------------------------------- -----------------------------------------------------------------
6217
141 invalid_piece_index One index in the 'slot' list is invalid
6218
------ ----------------------------------------- -----------------------------------------------------------------
6219
142 pieces_need_reorder The pieces on disk needs to be re-ordered for the specified
6220
allocation mode. This happens if you specify sparse allocation
6221
and the files on disk are using compact storage. The pieces needs
6222
to be moved to their right position
6223
====== ========================================= =================================================================
6227
====== ========================================= =================================================================
6228
150 http_parse_error The HTTP header was not correctly formatted
6229
------ ----------------------------------------- -----------------------------------------------------------------
6230
151 http_missing_location The HTTP response was in the 300-399 range but lacked a location
6232
------ ----------------------------------------- -----------------------------------------------------------------
6233
152 http_failed_decompress The HTTP response was encoded with gzip or deflate but
6234
decompressing it failed
6235
====== ========================================= =================================================================
6237
The names of these error codes are declared in then ``libtorrent::errors`` namespace.
6239
There is also another error category, ``libtorrent::upnp_category``, defining errors
6240
retrned by UPnP routers. Here's a (possibly incomplete) list of UPnP error codes:
6242
====== ========================================= ====================================================
6243
code symbol description
6244
====== ========================================= ====================================================
6246
------ ----------------------------------------- ----------------------------------------------------
6247
402 invalid_argument One of the arguments in the request is invalid
6248
------ ----------------------------------------- ----------------------------------------------------
6249
501 action_failed The request failed
6250
------ ----------------------------------------- ----------------------------------------------------
6251
714 value_not_in_array The specified value does not exist in the array
6252
------ ----------------------------------------- ----------------------------------------------------
6253
715 source_ip_cannot_be_wildcarded The source IP address cannot be wild-carded, but
6254
must be fully specified
6255
------ ----------------------------------------- ----------------------------------------------------
6256
716 external_port_cannot_be_wildcarded The external port cannot be wildcarded, but must
6258
------ ----------------------------------------- ----------------------------------------------------
6259
718 port_mapping_conflict The port mapping entry specified conflicts with a
6260
mapping assigned previously to another client
6261
------ ----------------------------------------- ----------------------------------------------------
6262
724 internal_port_must_match_external Internal and external port value must be the same
6263
------ ----------------------------------------- ----------------------------------------------------
6264
725 only_permanent_leases_supported The NAT implementation only supports permanent
6265
lease times on port mappings
6266
------ ----------------------------------------- ----------------------------------------------------
6267
726 remote_host_must_be_wildcard RemoteHost must be a wildcard and cannot be a
6268
specific IP addres or DNS name
6269
------ ----------------------------------------- ----------------------------------------------------
6270
727 external_port_must_be_wildcard ExternalPort must be a wildcard and cannot be a
6272
====== ========================================= ====================================================
6274
The UPnP errors are declared in the ``libtorrent::upnp_errors`` namespace.
6276
translating error codes
6277
-----------------------
6279
The error_code::message() function will typically return a localized error string,
6280
for system errors. That is, errors that belong to the generic or system category.
6282
Errors that belong to the libtorrent error category are not localized however, they
6283
are only available in english. In order to translate libtorrent errors, compare the
6284
error category of the ``error_code`` object against ``libtorrent::libtorrent_category``,
6285
and if matches, you know the error code refers to the list above. You can provide
6286
your own mapping from error code to string, which is localized. In this case, you
6287
cannot rely on ``error_code::message()`` to generate your strings.
6289
The numeric values of the errors are part of the API and will stay the same, although
6290
new error codes may be appended at the end.
6292
Here's a simple example of how to translate error codes::
6294
std::string error_code_to_string(boost::system::error_code const& ec)
6296
if (ec.category() != libtorrent::libtorrent_category)
6298
return ec.message();
6300
// the error is a libtorrent error
6302
int code = ec.value();
6303
static const char const* swedish[] =
6306
"en fil i torrenten kolliderar med en fil fr�n en annan torrent",
6307
"hash check misslyckades",
6308
"torrent filen �r inte en dictionary",
6309
"'info'-nyckeln saknas eller �r korrupt i torrentfilen",
6310
"'info'-f�ltet �r inte en dictionary",
6311
"'piece length' f�ltet saknas eller �r korrupt i torrentfilen",
6312
"torrentfilen saknar namnf�ltet",
6313
"ogiltigt namn i torrentfilen (kan vara en attack)",
6314
// ... more strings here
6317
// use the default error string in case we don't have it
6318
// in our translated list
6319
if (code < 0 || code >= sizeof(swedish)/sizeof(swedish[0]))
6320
return ec.message();
6322
return swedish[code];
4718
6325
storage_interface
4719
6326
=================
5057
6681
The file format is a bencoded dictionary containing the following fields:
5059
+----------------------+--------------------------------------------------------------+
5060
| ``file-format`` | string: "libtorrent resume file" |
5062
+----------------------+--------------------------------------------------------------+
5063
| ``file-version`` | integer: 1 |
5065
+----------------------+--------------------------------------------------------------+
5066
| ``info-hash`` | string, the info hash of the torrent this data is saved for. |
5068
+----------------------+--------------------------------------------------------------+
5069
| ``blocks per piece`` | integer, the number of blocks per piece. Must be: piece_size |
5070
| | / (16 * 1024). Clamped to be within the range [1, 256]. It |
5071
| | is the number of blocks per (normal sized) piece. Usually |
5072
| | each block is 16 * 1024 bytes in size. But if piece size is |
5073
| | greater than 4 megabytes, the block size will increase. |
5075
+----------------------+--------------------------------------------------------------+
5076
| ``pieces`` | A string with piece flags, one character per piece. |
5077
| | Bit 1 means we have that piece. |
5078
+----------------------+--------------------------------------------------------------+
5079
| ``slots`` | list of integers. The list maps slots to piece indices. It |
5080
| | tells which piece is on which slot. If piece index is -2 it |
5081
| | means it is free, that there's no piece there. If it is -1, |
5082
| | means the slot isn't allocated on disk yet. The pieces have |
5083
| | to meet the following requirement: |
5085
| | If there's a slot at the position of the piece index, |
5086
| | the piece must be located in that slot. |
5088
+----------------------+--------------------------------------------------------------+
5089
| ``peers`` | list of dictionaries. Each dictionary has the following |
5092
| | +----------+-----------------------------------------------+ |
5093
| | | ``ip`` | string, the ip address of the peer. This is | |
5094
| | | | not a binary representation of the ip | |
5095
| | | | address, but the string representation. It | |
5096
| | | | may be an IPv6 string or an IPv4 string. | |
5097
| | +----------+-----------------------------------------------+ |
5098
| | | ``port`` | integer, the listen port of the peer | |
5099
| | +----------+-----------------------------------------------+ |
5101
| | These are the local peers we were connected to when this |
5102
| | fast-resume data was saved. |
5104
+----------------------+--------------------------------------------------------------+
5105
| ``unfinished`` | list of dictionaries. Each dictionary represents an |
5106
| | piece, and has the following layout: |
5108
| | +-------------+--------------------------------------------+ |
5109
| | | ``piece`` | integer, the index of the piece this entry | |
5110
| | | | refers to. | |
5111
| | +-------------+--------------------------------------------+ |
5112
| | | ``bitmask`` | string, a binary bitmask representing the | |
5113
| | | | blocks that have been downloaded in this | |
5115
| | +-------------+--------------------------------------------+ |
5116
| | | ``adler32`` | The adler32 checksum of the data in the | |
5117
| | | | blocks specified by ``bitmask``. | |
5119
| | +-------------+--------------------------------------------+ |
5121
+----------------------+--------------------------------------------------------------+
5122
| ``file sizes`` | list where each entry corresponds to a file in the file list |
5123
| | in the metadata. Each entry has a list of two values, the |
5124
| | first value is the size of the file in bytes, the second |
5125
| | is the time stamp when the last time someone wrote to it. |
5126
| | This information is used to compare with the files on disk. |
5127
| | All the files must match exactly this information in order |
5128
| | to consider the resume data as current. Otherwise a full |
5129
| | re-check is issued. |
5130
+----------------------+--------------------------------------------------------------+
5131
| ``allocation`` | The allocation mode for the storage. Can be either ``full`` |
5132
| | or ``compact``. If this is full, the file sizes and |
5133
| | timestamps are disregarded. Pieces are assumed not to have |
5134
| | moved around even if the files have been modified after the |
5135
| | last resume data checkpoint. |
5136
+----------------------+--------------------------------------------------------------+
6683
+--------------------------+--------------------------------------------------------------+
6684
| ``file-format`` | string: "libtorrent resume file" |
6686
+--------------------------+--------------------------------------------------------------+
6687
| ``file-version`` | integer: 1 |
6689
+--------------------------+--------------------------------------------------------------+
6690
| ``info-hash`` | string, the info hash of the torrent this data is saved for. |
6692
+--------------------------+--------------------------------------------------------------+
6693
| ``blocks per piece`` | integer, the number of blocks per piece. Must be: piece_size |
6694
| | / (16 * 1024). Clamped to be within the range [1, 256]. It |
6695
| | is the number of blocks per (normal sized) piece. Usually |
6696
| | each block is 16 * 1024 bytes in size. But if piece size is |
6697
| | greater than 4 megabytes, the block size will increase. |
6699
+--------------------------+--------------------------------------------------------------+
6700
| ``pieces`` | A string with piece flags, one character per piece. |
6701
| | Bit 1 means we have that piece. |
6702
| | Bit 2 means we have verified that this piece is correct. |
6703
| | This only applies when the torrent is in seed_mode. |
6704
+--------------------------+--------------------------------------------------------------+
6705
| ``slots`` | list of integers. The list maps slots to piece indices. It |
6706
| | tells which piece is on which slot. If piece index is -2 it |
6707
| | means it is free, that there's no piece there. If it is -1, |
6708
| | means the slot isn't allocated on disk yet. The pieces have |
6709
| | to meet the following requirement: |
6711
| | If there's a slot at the position of the piece index, |
6712
| | the piece must be located in that slot. |
6714
+--------------------------+--------------------------------------------------------------+
6715
| ``total_uploaded`` | integer. The number of bytes that have been uploaded in |
6716
| | total for this torrent. |
6717
+--------------------------+--------------------------------------------------------------+
6718
| ``total_downloaded`` | integer. The number of bytes that have been downloaded in |
6719
| | total for this torrent. |
6720
+--------------------------+--------------------------------------------------------------+
6721
| ``active_time`` | integer. The number of seconds this torrent has been active. |
6722
| | i.e. not paused. |
6723
+--------------------------+--------------------------------------------------------------+
6724
| ``seeding_time`` | integer. The number of seconds this torrent has been active |
6726
+--------------------------+--------------------------------------------------------------+
6727
| ``num_seeds`` | integer. An estimate of the number of seeds on this torrent |
6728
| | when the resume data was saved. This is scrape data or based |
6729
| | on the peer list if scrape data is unavailable. |
6730
+--------------------------+--------------------------------------------------------------+
6731
| ``num_downloaders`` | integer. An estimate of the number of downloaders on this |
6732
| | torrent when the resume data was last saved. This is used as |
6733
| | an initial estimate until we acquire up-to-date scrape info. |
6734
+--------------------------+--------------------------------------------------------------+
6735
| ``upload_rate_limit`` | integer. In case this torrent has a per-torrent upload rate |
6736
| | limit, this is that limit. In bytes per second. |
6737
+--------------------------+--------------------------------------------------------------+
6738
| ``download_rate_limit`` | integer. The download rate limit for this torrent in case |
6739
| | one is set, in bytes per second. |
6740
+--------------------------+--------------------------------------------------------------+
6741
| ``max_connections`` | integer. The max number of peer connections this torrent |
6742
| | may have, if a limit is set. |
6743
+--------------------------+--------------------------------------------------------------+
6744
| ``max_uploads`` | integer. The max number of unchoked peers this torrent may |
6745
| | have, if a limit is set. |
6746
+--------------------------+--------------------------------------------------------------+
6747
| ``seed_mode`` | integer. 1 if the torrent is in seed mode, 0 otherwise. |
6748
+--------------------------+--------------------------------------------------------------+
6749
| ``file_priority`` | list of integers. One entry per file in the torrent. Each |
6750
| | entry is the priority of the file with the same index. |
6751
+--------------------------+--------------------------------------------------------------+
6752
| ``piece_priority`` | string of bytes. Each byte is interpreted as an integer and |
6753
| | is the priority of that piece. |
6754
+--------------------------+--------------------------------------------------------------+
6755
| ``auto_managed`` | integer. 1 if the torrent is auto managed, otherwise 0. |
6756
+--------------------------+--------------------------------------------------------------+
6757
| ``sequential_download`` | integer. 1 if the torrent is in sequential download mode, |
6759
+--------------------------+--------------------------------------------------------------+
6760
| ``paused`` | integer. 1 if the torrent is paused, 0 otherwise. |
6761
+--------------------------+--------------------------------------------------------------+
6762
| ``trackers`` | list of lists of strings. The top level list lists all |
6763
| | tracker tiers. Each second level list is one tier of |
6765
+--------------------------+--------------------------------------------------------------+
6766
| ``mapped_files`` | list of strings. If any file in the torrent has been |
6767
| | renamed, this entry contains a list of all the filenames. |
6768
| | In the same order as in the torrent file. |
6769
+--------------------------+--------------------------------------------------------------+
6770
| ``url-list`` | list of strings. List of url-seed URLs used by this torrent. |
6771
| | The urls are expected to be properly encoded and not contain |
6772
| | any illegal url characters. |
6773
+--------------------------+--------------------------------------------------------------+
6774
| ``httpseeds`` | list of strings. List of httpseed URLs used by this torrent. |
6775
| | The urls are expected to be properly encoded and not contain |
6776
| | any illegal url characters. |
6777
+--------------------------+--------------------------------------------------------------+
6778
| ``merkle tree`` | string. In case this torrent is a merkle torrent, this is a |
6779
| | string containing the entire merkle tree, all nodes, |
6780
| | including the root and all leaves. The tree is not |
6781
| | necessarily complete, but complete enough to be able to send |
6782
| | any piece that we have, indicated by the have bitmask. |
6783
+--------------------------+--------------------------------------------------------------+
6784
| ``peers`` | list of dictionaries. Each dictionary has the following |
6787
| | +----------+-----------------------------------------------+ |
6788
| | | ``ip`` | string, the ip address of the peer. This is | |
6789
| | | | not a binary representation of the ip | |
6790
| | | | address, but the string representation. It | |
6791
| | | | may be an IPv6 string or an IPv4 string. | |
6792
| | +----------+-----------------------------------------------+ |
6793
| | | ``port`` | integer, the listen port of the peer | |
6794
| | +----------+-----------------------------------------------+ |
6796
| | These are the local peers we were connected to when this |
6797
| | fast-resume data was saved. |
6799
+--------------------------+--------------------------------------------------------------+
6800
| ``unfinished`` | list of dictionaries. Each dictionary represents an |
6801
| | piece, and has the following layout: |
6803
| | +-------------+--------------------------------------------+ |
6804
| | | ``piece`` | integer, the index of the piece this entry | |
6805
| | | | refers to. | |
6806
| | +-------------+--------------------------------------------+ |
6807
| | | ``bitmask`` | string, a binary bitmask representing the | |
6808
| | | | blocks that have been downloaded in this | |
6810
| | +-------------+--------------------------------------------+ |
6811
| | | ``adler32`` | The adler32 checksum of the data in the | |
6812
| | | | blocks specified by ``bitmask``. | |
6814
| | +-------------+--------------------------------------------+ |
6816
+--------------------------+--------------------------------------------------------------+
6817
| ``file sizes`` | list where each entry corresponds to a file in the file list |
6818
| | in the metadata. Each entry has a list of two values, the |
6819
| | first value is the size of the file in bytes, the second |
6820
| | is the time stamp when the last time someone wrote to it. |
6821
| | This information is used to compare with the files on disk. |
6822
| | All the files must match exactly this information in order |
6823
| | to consider the resume data as current. Otherwise a full |
6824
| | re-check is issued. |
6825
+--------------------------+--------------------------------------------------------------+
6826
| ``allocation`` | The allocation mode for the storage. Can be either ``full`` |
6827
| | or ``compact``. If this is full, the file sizes and |
6828
| | timestamps are disregarded. Pieces are assumed not to have |
6829
| | moved around even if the files have been modified after the |
6830
| | last resume data checkpoint. |
6831
+--------------------------+--------------------------------------------------------------+