diff --git a/docs/building.html b/docs/building.html index 8e674e0a0..3defa3621 100644 --- a/docs/building.html +++ b/docs/building.html @@ -3,7 +3,7 @@
- +Table of contents
To acquire the latest version of libtorrent, you'll have to grab it from SVN. -You'll find instructions on how to do this here (see subversion access).
+You'll find instructions on how to do this here (see subversion access).The build systems supported "out of the box" in libtorrent are boost-build v2 (BBv2) and autotools (for unix-like systems). If you still can't build after following these instructions, you can usually get help in the #libtorrent IRC channel on irc.freenode.net.
-Community contributed build tutorials can be found on the wiki.
+Community contributed build tutorials can be found on the wiki.
To build libtorrent from svn you need to check out the libtorrent sources from @@ -69,8 +71,8 @@ sourceforge and also check out the asio sources from its sourceforge cvs. If you downloaded a release tarball, you can skip this section.
To prepare the directory structure for building, follow these steps:
The primary reason to use boost-build is that it will automatically build the dependent boost libraries with the correct compiler settings, in order to -ensure that the build targets are link compatible (see boost guidelines +ensure that the build targets are link compatible (see boost guidelines for some details on this issue).
Since BBv2 will build the boost libraries for you, you need the full boost source package. Having boost installed via some package system is usually not @@ -92,7 +94,7 @@ usually not set by the package installer).
to step 3 (assuming you also have boost build installed).You'll find boost here.
+You'll find boost here.
Extract the archive to some directory where you want it. For the sake of this guide, let's assume you extract the package to c:\boost_1_34_0 (I'm using a windows path in this example since if you're on linux/unix you're more likely @@ -150,7 +152,7 @@ using darwin : 3.3 : g++-3.3 ; using darwin : 4.0 : g++-4.0 ;
Note that the spaces around the semi-colons and colons are important!
-Also see the official installation instructions.
+Also see the official installation instructions.
Note
+When building on Solaris, you might have to specify stdlib=sun-stlport +on the bjam command line.
+The build targets are put in a directory called bin, and under it they are sorted in directories depending on the toolset and build variant used.
To build the examples, just change directory to the examples directory and @@ -215,7 +222,7 @@ Also, make sure the paths are correct in the different environments. In cygwin, /cygdrive/c/boost_1_34_0). In the windows environment, they should have the typical windows format (c:/boost_1_34_0).
The Jamfile will define NDEBUG when it's building a release build. -For more build configuration flags see Build configurations.
+For more build configuration flags see Build configurations.Build features:
geoip |
When building the example client on windows, you need to build with link=static otherwise you may get unresolved external symbols for some boost.program-options symbols. -For more information, see the Boost build v2 documentation, or more -specifically the section on builtin features. +For more information, see the Boost build v2 documentation, or more +specifically the section on builtin features.
@@ -435,7 +442,7 @@ and boost.program_options.
Step 1: Generating the build systemNo build system is present if libtorrent is checked out from CVS - it needs to be generated first. If you're building from a released tarball, -you may skip directly to Step 2: Running configure. +you may skip directly to Step 2: Running configure.Execute the following commands, in the given order, to generate the build system: @@ -544,7 +551,7 @@ filenames, so if your target is Windows 2000 and up, you may want to use build configurationsdiff --git a/docs/features.html b/docs/features.html index 8efe85c6f..3c7d3dadd 100644 --- a/docs/features.html +++ b/docs/features.html @@ -3,7 +3,7 @@ - +Author: |
-Arvid Norberg, arvid@rasterbar.com | Arvid Norberg, arvid@rasterbar.com |
+Version: |
+0.15.0 | |
Table of contents
libtorrent is a C++ library that aims to be a good alternative to all the -other bittorrent implementations around. It is a -library and not a full featured client, although it comes with a working -example client.
-The main goals of libtorrent are:
-libtorrent is a feature complete C++ bittorrent implementation focusing +on efficiency and scalability. It runs on embedded devices as well as +desktops. It boasts a well documented library interface that is easy to +use. It comes with a simple bittorrent client demonstrating the use of +the library.
libtorrent is still being developed, however it is stable. It is an ongoing -project (including this documentation). The current state includes the -following features:
+libtorrent is under active development. It is an ongoing project. Its +current state supports and includes the following features:
+All disk I/O in libtorrent is done asynchronously to the network thread, by the +disk io thread. When a block is read, the disk io thread reads all subsequent +blocks from that piece into the read cache, assuming that the peer requesting +the block will also request more blocks from the same piece. This decreases the +number of syscalls for reading data. It also decreases delay from seeking.
+Similarly, for write requests, blocks are cached and flushed to disk once one full +piece is complete or the piece is the least recently updated one when more cache +space is needed. The cache dynamically allocates space between the write and read +cache. The write cache is strictly prioritized over the read cache.
+The cache blocks that are in used, are locked into physical memory to avoid it +being paged out to disk. Allowing the disk cache to be paged out to disk means +that it would become extremely inefficient to flush it, since it would have to be +read back into physical memory only to be flushed back out to disk again.
+In order to conserve memory, and system calls, iovec file operations are +used to flush multiple cache blocks in a single call.
+On low-memory systems, the disk cache can be disabled altogether or set to smaller +limit, to save memory.
+On CPUs with small L2 caches, copying memory can be expensive operations. It is important +to keep copying to a minimum on such machines. This mostly applies to embedded systems.
+In order to minimize the number of times received data is copied, the receive buffer +for payload data is received directly into a page aligned disk buffer. If the connection +is encrypted, the buffer is decrypted in-place. The buffer is then moved into the disk +cache without being copied. Once all the blocks for a piece have been received, or the +cache needs to be flushed, all the blocks are passed directly to writev() to flush +them in a single syscall. This means a single copy into user space memory, and a single +copy back into kernel memory, as illustrated by this figure:
+ +When seeding and uploading in general, unnecessary copying is avoided by caching blocks +in aligned buffers, that are copied once into the peer's send buffer. The peer's send buffer +is not guaranteed to be aligned, even though it is most of the time. The send buffer is +then encrypted with the peer specific key and chained onto the iovec for sending. +This means there is one user space copy in order to allow unaligned peer requests and +peer-specific encryption. This is illustrated by the following figure:
+ +The piece picker is a central component in a bittorrent implementation. The piece picker +in libtorrent is optimized for quickly finding the rarest pieces. It keeps a list of all +available pieces sorted by rarity, and pieces with the same rarity, shuffled. The rarest +first mode is the dominant piece picker mode. Other modes are supported as well, and +used by peers in specific situations.
+The piece picker allows to combine the availability of a piece with a priority. Together +they determine the sort order of the piece list. Pieces with priority 0 will never be +picked, which is used for the selective download feature.
+In order to have as few partially finished pieces as possible, peers have an affinity +towards picking blocks from the same pieces as other peers in the same speed category. +The speed category is a coarse categorization of peers based on their download rate. This +makes slow peers pick blocks from the same piece, and fast peers pick from the same piece, +and hence decreasing the likelihood of slow peers blocking the completion of pieces.
+The piece picker can also be set to download pieces in sequential order.
+libtorrent is portable at least among Windows, MacOS X and other UNIX-systems. +
libtorrent runs on most major operating systems, including Windows, +MacOS X, Linux, BSD and Solaris. It uses Boost.Thread, Boost.Filesystem, Boost.Date_time and various other -boost libraries as well as zlib (shipped) and asio (shipped). At least version +boost libraries as well as zlib (shipped) and asio (shipped). At least version 1.34.1 of boost is required.
-Since libtorrent uses asio, it will take full advantage of high performance +
libtorrent uses asio, hence it will take full advantage of high performance network APIs on the most popular platforms. I/O completion ports on windows, epoll on linux and kqueue on MacOS X and BSD.
libtorrent has been successfully compiled and tested on:
Fails on:
@@ -142,15 +227,6 @@ epoll on linux and kqueue on MacOS X and BSD.libtorrent is released under the BSD-license.
-This means that you can use the library in your project without having to -release its source code. The only requirement is that you give credit -to the author of the library by including the libtorrent license in your -software or documentation.
-Here's a list of some projects that uses libtorrent.
Table of contents
construct a session
start extensions (see add_extension()).
+start extensions (see add_extension()).
start DHT, LSD, UPnP, NAT-PMP etc (see start_dht() stop_dht() set_dht_settings() dht_state() -start_lsd() stop_lsd(), start_upnp() stop_upnp() and start_natpmp() stop_natpmp())
+start DHT, LSD, UPnP, NAT-PMP etc (see start_dht() stop_dht() set_dht_settings() dht_state() +start_lsd() stop_lsd(), start_upnp() stop_upnp() and start_natpmp() stop_natpmp())
parse .torrent-files and add them to the session (see bdecode() bencode() and add_torrent())
+parse .torrent-files and add them to the session (see bdecode() bencode() and add_torrent())
main loop (see session)
+main loop (see session)
-
- query the torrent_handles for progress (see torrent_handle)
+- query the torrent_handles for progress (see torrent_handle)
- query the session for information
- add and remove torrents from the session at run-time
save resume data for all torrent_handles (optional, see -save_resume_data())
+save_resume_data())destruct session object
Each class and function is described in this manual.
-For a description on how to create torrent files, see make_torrent.
+For a description on how to create torrent files, see make_torrent.
Which are the endpoint types used in libtorrent. An endpoint is an address with an associated port.
-For documentation on these types, please refer to the asio documentation.
+For documentation on these types, please refer to the asio documentation.
session(fingerprint const& print = libtorrent::fingerprint("LT", 0, 1, 0, 0) - , int flags = start_default_features | add_default_plugins + , int flags = start_default_features + | add_default_plugins , int alert_mask = alert::error_notification); session(fingerprint const& print , std::pair<int, int> listen_port_range , char const* listen_interface = 0 - , int flags = start_default_features | add_default_plugins + , int flags = start_default_features + | add_default_plugins , int alert_mask = alert::error_notification);
If the fingerprint in the first overload is omited, the client will get a default
fingerprint stating the version of libtorrent. The fingerprint is a short string that will be
used in the peer-id to identify the client and the client's version. For more details see the
-fingerprint class. The constructor that only takes a fingerprint will not open a
+fingerprint class. The constructor that only takes a fingerprint will not open a
listen port for the session, to get it running you'll have to call session::listen_on().
The other constructor, that takes a port range and an interface as well as the fingerprint
will automatically try to listen on a port on the given interface. For more information about
@@ -461,7 +466,7 @@ the parameters, see listen_on()
The flags paramater can be used to start default features (upnp & nat-pmp) and default plugins
(ut_metadata, ut_pex and smart_ban). The default is to start those things. If you do not want
them to start, pass 0 as the flags parameter. The alert_mask is the same mask that you would send to set_alert_mask(). The alert_mask is the same mask that you would send to set_alert_mask().
Pausing the session has the same effect as pausing every torrent in it. Resuming -will restore the torrents to their previous paused state. i.e. the session pause -state is separate from the torrent pause state. A torrent is inactive if it is -paused or if the session is paused.
+Pausing the session has the same effect as pausing every torrent in it, except that +torrents will not be resumed by the auto-manage mechanism. Resuming will restore the +torrents to their previous paused state. i.e. the session pause state is separate from +the torrent pause state. A torrent is inactive if it is paused or if the session is +paused.
The optional parameter, resume_data can be given if up to date fast-resume data is available. The fast-resume data can be acquired from a running torrent by calling -save_resume_data() on torrent_handle. See fast resume. The vector that is +save_resume_data() on torrent_handle. See fast resume. The vector that is passed in will be swapped into the running torrent instance with std::vector::swap().
The storage_mode parameter refers to the layout of the storage for this torrent. There are 3 different modes:
@@ -579,7 +586,7 @@ with zeroes. are rearranged to finally be in their correct places once the entire torrent has been downloaded. -For more information, see storage allocation.
+For more information, see storage allocation.
paused is a boolean that specifies whether or not the torrent is to be started in a paused state. I.e. it won't connect to the tracker or any of the peers until it's resumed. This is typically a good way of avoiding race conditions when setting @@ -587,15 +594,24 @@ configuration options on torrents before starting them.
If auto_managed is true, this torrent will be queued, started and seeded automatically by libtorrent. When this is set, the torrent should also be started as paused. The default queue order is the order the torrents were added. They -are all downloaded in that order. For more details, see queuing.
+are all downloaded in that order. For more details, see queuing.storage can be used to customize how the data is stored. The default storage will simply write the data to the files it belongs to, but it could be overridden to save everything to a single file at a specific location or encrypt the content on disk for instance. For more information about the storage_interface -that needs to be implemented for a custom storage, see storage_interface.
+that needs to be implemented for a custom storage, see storage_interface.The userdata parameter is optional and will be passed on to the extension -constructor functions, if any (see add_extension()).
-The torrent_handle returned by add_torrent() can be used to retrieve information +constructor functions, if any (see add_extension()).
+If seed_mode is set to true, libtorrent will assume that all files are present +for this torrent and that they all match the hashes in the torrent file. Each time +a peer requests to download a block, the piece is verified against the hash, unless +it has been verified already. If a hash fails, the torrent will automatically leave +the seed mode and recheck all the files. The use case for this mode is if a torrent +is created and seeded, or if the user already know that the files are complete, this +is a way to avoid the initial file checks, and significantly reduce the startup time.
+Setting seed_mode on a torrent without metadata (a .torrent file) is a no-op +and will be ignored.
+The torrent_handle returned by add_torrent() can be used to retrieve information about the torrent's progress, its peers etc. It is also used to abort a torrent.
These functions are not available if TORRENT_DISABLE_GEO_IP is defined. They -expects a path to the MaxMind ASN database and MaxMind GeoIP database +expects a path to the MaxMind ASN database and MaxMind GeoIP database respectively. This will be used to look up which AS and country peers belong to.
as_for_ip returns the AS number for the IP address specified. If the IP is not in the database or the ASN database is not loaded, 0 is returned.
@@ -732,8 +748,8 @@ void set_ip_filter(ip_filter const& filter);Sets a filter that will be used to reject and accept incoming as well as outgoing connections based on their originating ip address. The default filter will allow connections to any ip address. To build a set of rules for which addresses are -accepted and not, see ip_filter.
-Each time a peer is blocked because of the IP filter, a peer_blocked_alert is +accepted and not, see ip_filter.
+Each time a peer is blocked because of the IP filter, a peer_blocked_alert is generated.
The interface parameter can also be a hostname that will resolve to the device you want to listen on.
If you're also starting the DHT, it is a good idea to do that after you've called @@ -968,7 +984,7 @@ void set_alert_mask(int m);
Changes the mask of which alerts to receive. By default only errors are reported. m is a bitmask where each bit represents a category of alerts.
-See alerts for mor information on the alert categories.
+See alerts for mor information on the alert categories.
pop_alert() is used to ask the session if any errors or events has occurred. With -set_alert_mask() you can filter which alerts to receive through pop_alert(). -For information about the alert categories, see alerts.
+set_alert_mask() you can filter which alerts to receive through pop_alert(). +For information about the alert categories, see alerts.wait_for_alert blocks until an alert is available, or for no more than max_wait time. If wait_for_alert returns because of the time-out, and no alerts are available, it returns 0. If at least one alert was generated, a pointer to that alert is returned. @@ -1004,7 +1020,7 @@ void add_extension(boost::function<
This function adds an extension to this session. The argument is a function object that is called with a torrent* and which should return a boost::shared_ptr<torrent_plugin>. To write custom plugins, see -libtorrent plugins. For the typical bittorrent client all of these +libtorrent plugins. For the typical bittorrent client all of these extensions should be added. The main plugins implemented in libtorrent are:
Sets the session settings and the packet encryption settings respectively. -See session_settings and pe_settings for more information on available +See session_settings and pe_settings for more information on available options.
set_peer_proxy affects regular bittorrent peers. set_web_seed_proxy -affects only web seeds. see HTTP seeding.
+affects only web seeds. see HTTP seeding.set_tracker_proxy only affects HTTP tracker connections (UDP tracker connections are affected if the given proxy supports UDP, e.g. SOCKS5).
set_dht_proxy affects the DHT messages. Since they are sent over UDP, it only has any effect if the proxy supports UDP.
For more information on what settings are available for proxies, see -proxy_settings.
+proxy_settings.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.
+portmap_alert and the portmap_error_alert. The object will be valid until +stop_upnp() is called. See UPnP and NAT-PMP.It is off by default.
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.
+portmap_alert and the portmap_error_alert. The object will be valid until +stop_natpmp() is called. See UPnP and NAT-PMP.It is off by default.
The integer(), string(), list() and dict() functions are accessors that return the respective type. If the entry object isn't of the -type you request, the accessor will throw type_error (which derives from +type you request, the accessor will throw type_error (which derives from std::runtime_error). You can ask an entry for its type through the type() function.
The print() function is there for debug purposes only.
@@ -1330,7 +1346,7 @@ if (entry* i = torrent_file.find_key("announce")) std::cout << tracker_url << "\n"; } -To make it easier to extract information from a torrent file, the class torrent_info +
To make it easier to extract information from a torrent file, the class torrent_info exists.
In previous versions of libtorrent, this class was also used for creating torrent files. This functionality has been moved to create_torrent, see -make_torrent.
+make_torrent.The torrent_info has the following synopsis:
class torrent_info @@ -1456,7 +1472,7 @@ from the swarm.The constructor that takes a lazy_entry will create a torrent_info object from the information found in the given torrent_file. The lazy_entry represents a tree node in an bencoded file. To load an ordinary .torrent file -into a lazy_entry, use lazy_bdecode(), see bdecode() bencode().
+into a lazy_entry, use lazy_bdecode(), see bdecode() bencode().The version that takes a buffer pointer and a size will decode it as a .torrent file and initialize the torrent_info object for you.
The version that takes a filename will simply load the torrent file and decode it inside @@ -1471,7 +1487,7 @@ void add_tracker(std::string const& url, int tier = 0);
add_tracker() adds a tracker to the announce-list. The tier determines the order in -which the trackers are to be tried. For more information see trackers().
+which the trackers are to be tried. For more information see trackers().See HTTP seeding for more information.
+See HTTP seeding for more information.
hash_for_piece() takes a piece-index and returns the 20-bytes sha1-hash for that piece and info_hash() returns the 20-bytes sha1-hash for the info-section of the -torrent file. For more information on the sha1_hash, see the big_number class. +torrent file. For more information on the sha1_hash, see the big_number class. hash_for_piece_ptr() returns a pointer to the 20 byte sha1 digest for the piece. Note that the string is not null-terminated.
name() returns the name of the torrent.
comment() returns the comment associated with the torrent. If there's no comment, -it will return an empty string. creation_date() returns a boost::posix_time::ptime +it will return an empty string. creation_date() returns a boost::posix_time::ptime object, representing the time when this torrent file was created. If there's no time stamp in the torrent file, this will return a date of January 1:st 1970.
Both the name and the comment is UTF-8 encoded strings.
@@ -1873,7 +1889,7 @@ valid handle. If you try to perform any operation on an uninitialized handle, it will throw invalid_handle.Warning
-All operations on a torrent_handle may throw invalid_handle +
All operations on a torrent_handle may throw invalid_handle exception, in case the handle is no longer refering to a torrent. There is one exception is_valid() will never throw. Since the torrents are processed by a background thread, there is no @@ -1950,7 +1966,7 @@ void file_progress(std::vector<size_type>& fp);
This function fills in the supplied vector with the the number of bytes downloaded of each file in this torrent. The progress values are ordered the same as the files -in the torrent_info. This operation is not very cheap. Its complexity is O(n + mj). +in the torrent_info. This operation is not very cheap. Its complexity is O(n + mj). Where n is the number of files, m is the number of downloading pieces and j is the number of blocks in a piece.
save_path() returns the path that was given to add_torrent() when this torrent +
save_path() returns the path that was given to add_torrent() when this torrent was started.
When the read operation is completed, it is passed back through an alert, -read_piece_alert. In order to receive this alert, you must enable -alert::storage_notification in your alert mask (see set_alert_mask()).
+read_piece_alert. In order to receive this alert, you must enable +alert::storage_notification in your alert mask (see set_alert_mask()).Note that if you read multiple pieces, the read operations are not guaranteed to finish in the same order as you initiated them.
This request will specifically update the num_complete and num_incomplete fields in -the torrent_status struct once it completes. When it completes, it will generate a -scrape_reply_alert. If it fails, it will generate a scrape_failed_alert.
+the torrent_status struct once it completes. When it completes, it will generate a +scrape_reply_alert. If it fails, it will generate a scrape_failed_alert.torrents that are auto-managed may be automatically resumed again. It does not make sense to +pause an auto-managed torrent without making it not automanaged first. Torrents are auto-managed +by default when added to the session. For more information, see queuing.
is_paused() only returns true if the torrent itself is paused. If the torrent is not running because the session is paused, this still returns false. To know if a torrent is active or not, you need to inspect both torrent_handle::is_paused() @@ -2212,8 +2231,8 @@ bool resolve_countries() const;
Sets or gets the flag that derermines if countries should be resolved for the peers of this -torrent. It defaults to false. If it is set to true, the peer_info structure for the peers -in this torrent will have their country member set. See peer_info for more information +torrent. It defaults to false. If it is set to true, the peer_info structure for the peers +in this torrent will have their country member set. See peer_info for more information on how to interpret this field.
is_auto_managed() returns true if this torrent is currently auto managed. auto_managed() changes whether the torrent is auto managed or not. For more info, -see queuing.
+see queuing.has_metadata returns true if this torrent has metadata (either it was started from a .torrent file or the metadata has been downloaded). The only scenario where this can return false is when the torrent was started torrent-less (i.e. with just an info-hash and tracker -ip). Note that if the torrent doesn't have metadata, the member get_torrent_info() will +ip). Note that if the torrent doesn't have metadata, the member get_torrent_info() will throw.
set_metadata expects the info section of metadata. i.e. The buffer passed in will be hashed and verified against the info-hash. If it fails, a metadata_failed_alert will be @@ -2283,7 +2302,7 @@ which this tracker is tried. If you want libtorrent to use another list of trackers for this torrent, you can use replace_trackers() which takes a list of the same form as the one returned from trackers() and will replace it. If you want an immediate effect, you have to call -force_reannounce().
+force_reannounce().add_tracker() will look if the specified tracker is already in the set. If it is, it doesn't do anything. If it's not in the current set of trackers, it will insert it in the tier specified in the announce_entry.
@@ -2304,7 +2323,7 @@ paused, queued, checking or seeding. url_seeds() return a set of the url seeds currently in this torrent. Note that urls that fails may be removed automatically from the list. -See HTTP seeding for more information.
+See HTTP seeding for more information.
These functions are identical as the *_url_seed() variants, but they operate on BEP 17 web seeds instead of BEP 19.
-See HTTP seeding for more information.
+See HTTP seeding for more information.
use_interface() sets the network interface this torrent will use when it opens outgoing -connections. By default, it uses the same interface as the session uses to listen on. The +connections. By default, it uses the same interface as the session uses to listen on. The parameter must be a string containing an ip-address (either an IPv4 or IPv6 address). If the string does not conform to this format and exception is thrown.
save_resume_data() generates fast-resume data and returns it as an entry. This entry -is suitable for being bencoded. For more information about how fast-resume works, see fast resume.
+save_resume_data() generates fast-resume data and returns it as an entry. This entry +is suitable for being bencoded. For more information about how fast-resume works, see fast resume.
This operation is asynchronous, save_resume_data will return immediately. The resume data -is delivered when it's done through an save_resume_data_alert.
+is delivered when it's done through an save_resume_data_alert.The fast resume data will be empty in the following cases:
@@ -2398,13 +2417,13 @@ is delivered when it's done through an metadata from peers extension) +(see libtorrent's metadata from peers extension)
Note that by the time you receive the fast resume data, it may already be invalid if the torrent is still downloading! The recommended practice is to first pause the session, then generate the -fast resume data, and then close it down. Make sure to not remove_torrent() before you receive -the save_resume_data_alert though. There's no need to pause when saving intermittent resume data.
+fast resume data, and then close it down. Make sure to not remove_torrent() before you receive +the save_resume_data_alert though. There's no need to pause when saving intermittent resume data.Warning
If you pause every torrent individually instead of pausing the session, every torrent @@ -2420,7 +2439,7 @@ have their resume data saved when they complete and on exit, since their statist
In full allocation mode the reume data is never invalidated by subsequent writes to the files, since pieces won't move around. This means that you don't need to pause before writing resume data in full or sparse mode. If you don't, however, any data written to -disk after you saved resume data and before the session closed is lost.
+disk after you saved resume data and before the session closed is lost.It also means that if the resume data is out dated, libtorrent will not re-check the files, but assume that it is fairly recent. The assumption is that it's better to loose a little bit than to re-check @@ -2483,8 +2502,8 @@ torrent_status status() const;
status() will return a structure with information about the status of this -torrent. If the torrent_handle is invalid, it will throw invalid_handle exception. -See torrent_status.
+torrent. If the torrent_handle is invalid, it will throw invalid_handle exception. +See torrent_status.get_peer_info() takes a reference to a vector that will be cleared and filled with one entry for each peer connected to this torrent, given the handle is valid. If the -torrent_handle is invalid, it will throw invalid_handle exception. Each entry in -the vector contains information about that particular peer. See peer_info.
+torrent_handle is invalid, it will throw invalid_handle exception. Each entry in +the vector contains information about that particular peer. See peer_info.Returns a const reference to the torrent_info object associated with this torrent. +This reference is valid as long as the torrent_handle is valid, no longer. If the +torrent_handle is invalid or if it doesn't have any metadata, invalid_handle exception will be thrown. The torrent may be in a state without metadata only if it was started without a .torrent file, i.e. by using the libtorrent extension of just supplying a tracker and info-hash.
@@ -2576,7 +2595,7 @@ bool is_valid() const; or if the torrent it refers to has been aborted. Note that a handle may become invalid after it has been added to the session. Usually this is because the storage for the torrent is somehow invalid or if the filenames are not allowed (and hence cannot be opened/created) on -your filesystem. If such an error occurs, a file_error_alert is generated and all handles +your filesystem. If such an error occurs, a file_error_alert is generated and all handles that refers to that torrent will become invalid.progress is a value in the range [0, 1], that represents the progress of the @@ -2766,7 +2787,7 @@ be slightly smaller than the other rates, but if projected over a long time
num_peers is the number of peers this torrent currently is connected to. Peer connections that are in the half-open state (is attempting to connect) or are queued for later connection attempt do not count. Although they are -visible in the peer list when you call get_peer_info().
+visible in the peer list when you call get_peer_info().num_complete and num_incomplete are set to -1 if the tracker did not send any scrape data in its announce reply. This data is optional and may not be available from all trackers. If these are not -1, they are the total @@ -2804,7 +2825,7 @@ copies is set to -1.
block_size is the size of a block, in bytes. A block is a sub piece, it is the number of bytes that each piece request asks for and the number of bytes that each bit in the partial_piece_info's bitset represents -(see get_download_queue()). This is typically 16 kB, but it may be +(see get_download_queue()). This is typically 16 kB, but it may be larger if the pieces are larger.
num_uploads is the number of unchoked peers in this torrent.
num_connections is the number of peer connections this torrent has, including @@ -2814,7 +2835,7 @@ always <= num_peersconnections_limit is the set limit of number of connections for this torrent.
storage_mode is one of storage_mode_allocate, storage_mode_sparse or storage_mode_compact. Identifies which storage mode this torrent is being saved -with. See Storage allocation.
+with. See Storage allocation.up_bandwidth_queue and down_bandwidth_queue are the number of peers in this
torrent that are waiting for more bandwidth quota from the torrent rate limiter.
This can determine if the rate you get from this torrent is bound by the torrents
@@ -2831,7 +2852,7 @@ seconds it has been active while being a seed. seed_rank is a rank of how important it is to seed the torrent, it is used
to determine which torrents to seed and which to queue. It is based on the peer
-to seed ratio from the tracker scrape. For more information, see queuing.
last_scrape is the number of seconds since this torrent acquired scrape data. If it has never done that, this value is -1.
has_incoming is true if there has ever been an incoming connection attempt @@ -2839,6 +2860,9 @@ to this torrent.'
sparse_regions the number of regions of non-downloaded pieces in the torrent. This is an interesting metric on windows vista, since there is a limit on the number of sparse regions in a single file there.
+seed_mode is true if the torrent is in seed_mode. If the torrent was +started in seed mode, it will leave seed mode once all pieces have been +checked or as soon as one piece fails the hash check.
The ip field is the IP-address to this peer. The type is an asio endpoint. For -more info, see the asio documentation.
+more info, see the asio documentation.up_speed and down_speed contains the current upload and download speed we have to and from this peer (including any protocol messages). The transfer rates of payload data only are found in payload_up_speed and payload_down_speed. @@ -3116,12 +3140,12 @@ and used for the peer's send buffer, respectively.
allocated and used as receive buffer, respectively.num_hashfails is the number of pieces this peer has participated in sending us that turned out to fail the hash check.
-country is the two letter ISO 3166 country code for the country the peer +
country is the two letter ISO 3166 country code for the country the peer is connected from. If the country hasn't been resolved yet, both chars are set to 0. If the resolution failed for some reason, the field is set to "--". If the resolution service returns an invalid country code, it is set to "!!". The countries.nerd.dk service is used to look up countries. This field will -remain set to 0 unless the torrent is set to resolve countries, see resolve_countries().
+remain set to 0 unless the torrent is set to resolve countries, see resolve_countries().inet_as_name is the name of the AS this peer is located in. This might be an empty string if there is no name in the geo ip database.
inet_as is the AS number the peer is located in.
@@ -3254,6 +3278,8 @@ struct session_settings int seeding_piece_quota; int max_sparse_regions; + + bool lock_disk_cache; };user_agent this is the client identification to the tracker. @@ -3383,9 +3409,9 @@ message or a time out.
are kept in memory after the torrent becomes a seed or not. If it is set to true the hashes are freed once the torrent is a seed (they're not needed anymore since the torrent won't download anything more). If it's set -to false they are not freed. If they are freed, the torrent_info returned +to false they are not freed. If they are freed, the torrent_info returned by get_torrent_info() will return an object that may be incomplete, that -cannot be passed back to add_torrent() for instance. +cannot be passed back to add_torrent() for instance.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 @@ -3428,7 +3454,7 @@ to peers if a previous socket to that peer and port is in 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.
+the QBone scavenger service. For more details, see QBSS.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). @@ -3451,12 +3477,12 @@ slow torrents.
auto_manage_interval is the number of seconds between the torrent queue is updated, and rotated.
share_ratio_limit is the upload / download ratio limit for considering a -seeding torrent have met the seed limit criteria. See queuing.
+seeding torrent have met the seed limit criteria. See queuing.seed_time_ratio_limit is the seeding time / downloading time ratio limit -for considering a seeding torrent to have met the seed limit criteria. See queuing.
+for considering a seeding torrent to have met the seed limit criteria. See queuing.seed_time_limit 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.
+See queuing.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 @@ -3519,6 +3545,9 @@ limit is not hard, it will be exceeded. Once it's exceeded, pieces that will maintain or decrease the number of sparse regions are prioritized. To disable this functionality, set this to 0. It defaults to 0 on all platforms except windows.
+lock_disk_cache if lock disk cache is set to true the disk cache +that's in use, will be locked in physical memory, preventing it from +being swapped out.
There's currently an informal directory of client id's here.
+There's currently an informal directory of client id's here.
The major, minor, revision and tag parameters are used to identify the version of your client. All these numbers must be within the range [0, 9].
to_string() will generate the actual string put in the peer-id, and return it.
@@ -3924,13 +3953,13 @@ int add_mapping(protocol_type p, int external_port, int local_port); natpmp::udp for the NAT-PMP class.external_port is the port on the external address that will be mapped. This is a hint, you are not guaranteed that this port will be available, and it may -end up being something else. In the portmap_alert notification, the actual +end up being something else. In the portmap_alert notification, the actual external port is reported.
local_port is the port in the local machine that the mapping should forward to.
The return value is an index that identifies this port mapping. This is used -to refer to mappings that fails or succeeds in the portmap_error_alert and -portmap_alert respectively. If The mapping fails immediately, the return value +to refer to mappings that fails or succeeds in the portmap_error_alert and +portmap_alert respectively. If The mapping fails immediately, the return value is -1, which means failure. There will not be any error alert notification for mappings that fail with a -1 return value.
This function removes a port mapping. mapping_index is the index that refers -to the mapping you want to remove, which was returned from add_mapping.
+to the mapping you want to remove, which was returned from add_mapping.These functions will encode data to bencoded or decode bencoded data.
-The entry class is the internal representation of the bencoded data -and it can be used to retrieve information, an entry can also be build by +
These functions will encode data to bencoded or decode bencoded data.
+The entry class is the internal representation of the bencoded data +and it can be used to retrieve information, an entry can also be build by the program and given to bencode() to encode it into the OutIt iterator.
The OutIt and InIt are iterators -(InputIterator and OutputIterator respectively). They -are templates and are usually instantiated as ostream_iterator, -back_insert_iterator or istream_iterator. These +(InputIterator and OutputIterator respectively). They +are templates and are usually instantiated as ostream_iterator, +back_insert_iterator or istream_iterator. These functions will assume that the iterator refers to a character (char). So, if you want to encode entry e into a buffer in memory, you can do it like this:
@@ -4016,9 +4045,9 @@ const char* buf; // ... entry e = bdecode(buf, buf + data_size); -Now we just need to know how to retrieve information from the entry.
+Now we just need to know how to retrieve information from the entry.
If bdecode() encounters invalid encoded data in the range given to it -it will throw invalid_encoding.
+it will throw invalid_encoding.For more information about magnet links, see magnet links.
+the add_torrent_params, p. See add_torrent(). +For more information about magnet links, see magnet links.
Generates a magnet URI from the specified torrent. If the torrent handle is invalid, an empty string is returned.
-For more information about magnet links, see magnet links.
+For more information about magnet links, see magnet links.
By default, only errors are reported. set_alert_mask() can be +
By default, only errors are reported. set_alert_mask() can be used to specify which kinds of events should be reported. The alert mask is a bitmask with the following bits: