diff --git a/docs/manual.html b/docs/manual.html index dbcb89f1c..b55ba0ccc 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -3,7 +3,7 @@ - + libtorrent API Documentation @@ -16,241 +16,241 @@ Author: -Arvid Norberg, arvid@rasterbar.com +Arvid Norberg, arvid@rasterbar.com Version: 0.13
-

Table of contents

+

Table of contents

-
-

overview

+
+

overview

The interface of libtorrent consists of a few classes. The main class is the session, it contains the main loop that serves all torrents.

The basic usage is as follows:

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.

-
-

network primitives

+
+

network primitives

There are a few typedefs in the libtorrent namespace which pulls in network types from the asio namespace. These are:

@@ -268,10 +268,10 @@ udp::endpoint
 

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

+
+

session

The session class has the following synopsis:

 class session: public boost::noncopyable
@@ -370,8 +370,8 @@ class session: public boost::noncopyable
 

Once it's created, the session object will spawn the main thread that will do all the work. The main thread will be idle as long it doesn't have any torrents to participate in.

-
-

session()

+
+

session()

 session(fingerprint const& print
@@ -384,22 +384,22 @@ session(fingerprint const& print
 

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 the parameters, see listen_on() function.

-
-

~session()

+
+

~session()

The destructor of session will notify all trackers that our torrents have been shut down. If some trackers are down, they will time out. All this before the destructor of session returns. So, it's advised that any kind of interface (such as windows) are closed before destructing the session object. Because it can take a few second for it to finish. The timeout can be set with set_settings().

-
-

abort()

+
+

abort()

 session_proxy abort();
 
@@ -421,8 +421,8 @@ public: };
-
-

add_torrent()

+
+

add_torrent()

 typedef storage_interface* (&storage_constructor_type)(
@@ -465,12 +465,12 @@ the torrent as long as it doesn't have metadata. See add_torrent() will throw
-duplicate_torrent which derives from std::exception unless duplicate_is_error
+duplicate_torrent which derives from std::exception unless duplicate_is_error
 is set to false. In that case, add_torrent will return the handle to the existing
 torrent.

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.

+save_resume_data() on torrent_handle. See fast resume.

The storage_mode parameter refers to the layout of the storage for this torrent. There are 3 different modes:

@@ -486,7 +486,7 @@ filesystems that don't support sparse files. 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 @@ -494,19 +494,19 @@ 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()).

+

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.

-
-

remove_torrent()

+
+

remove_torrent()

 void remove_torrent(torrent_handle const& h, int options = none);
@@ -517,10 +517,10 @@ the tracker that we've stopped participating in the swarm. The optional second a
 options can be used to delete all the files downloaded by this torrent. To do this, pass
 in the value session::delete_files. The removal of the torrent is asyncronous, there is
 no guarantee that adding the same torrent immediately after it was removed will not throw
-a duplicate_torrent exception.

+a duplicate_torrent exception.

-
-

find_torrent() get_torrents()

+
+

find_torrent() get_torrents()

 torrent_handle find_torrent(sha_hash const& ih);
@@ -534,8 +534,8 @@ In case the torrent cannot be found, an invalid torrent_handle is returned.

get_torrents() returns a vector of torrent_handles to all the torrents currently in the session.

-
-

set_upload_rate_limit() set_download_rate_limit() upload_rate_limit() download_rate_limit()

+
+

set_upload_rate_limit() set_download_rate_limit() upload_rate_limit() download_rate_limit()

 void set_upload_rate_limit(int bytes_per_second);
@@ -552,8 +552,8 @@ of upload rate.
 download_rate_limit() and upload_rate_limit() returns the previously
 set limits.

-
-

set_max_uploads() set_max_connections()

+
+

set_max_uploads() set_max_connections()

 void set_max_uploads(int limit);
@@ -566,8 +566,8 @@ minimum of at least two connections per torrent, so if you set a too low
 connections limit, and open too many torrents, the limit will not be met. The
 number of uploads is at least one per torrent.

-
-

num_uploads() num_connections()

+
+

num_uploads() num_connections()

 int num_uploads() const;
@@ -577,8 +577,8 @@ int num_connections() const;
 

Returns the number of currently unchoked peers and the number of connections (including half-open ones) respectively.

-
-

set_max_half_open_connections() max_half_open_connections()

+
+

set_max_half_open_connections() max_half_open_connections()

 void set_max_half_open_connections(int limit);
@@ -597,8 +597,8 @@ their turn to get connected.

max_half_open_connections() returns the set limit. This limit defaults to 8 on windows.

-
-

load_asnum_db() load_country_db() int as_for_ip()

+
+

load_asnum_db() load_country_db() int as_for_ip()

 bool load_asnum_db(char const* file);
@@ -607,13 +607,13 @@ int as_for_ip(address const& adr);
 

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.

-
-

load_state() state()

+
+

load_state() state()

 void load_state(entry const& ses_state);
@@ -624,8 +624,8 @@ entry state() const;
 that's stored is peak download rates for ASes. This map is used to
 determine which order to connect to peers.

-
-

set_ip_filter()

+
+

set_ip_filter()

 void set_ip_filter(ip_filter const& filter);
@@ -634,12 +634,12 @@ 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.

-
-

status()

+
+

status()

 session_status status() const;
@@ -701,8 +701,8 @@ becomes unresponsive.

dht_global_nodes is an estimation of the total number of nodes in the DHT network.

-
-

get_cache_status()

+
+

get_cache_status()

 cache_status get_cache_status() const;
@@ -739,8 +739,8 @@ for the read cache.

This includes both read and write cache.

read_cache_size is the number of 16KiB blocks in the read cache.

-
-

get_cache_info()

+
+

get_cache_info()

 void get_cache_info(sha1_hash const& ih
@@ -766,8 +766,8 @@ the data for that block being in the disk cache and last_use is the time when a block was last written to this piece. The older
 a piece is, the more likely it is to be flushed to disk.

-
-

is_listening() listen_port() listen_on()

+
+

is_listening() listen_port() listen_on()

 bool is_listening() const;
@@ -791,7 +791,7 @@ the range and so on. The interface parameter can be left as 0, in that case the
 os will decide which interface to listen on, otherwise it should be the ip-address
 of the interface you want the listener socket bound to. listen_on() returns true
 if it managed to open the socket, and false if it failed. If it fails, it will also
-generate an appropriate alert (listen_failed_alert).

+generate an appropriate alert (listen_failed_alert).

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 @@ -810,8 +810,8 @@ with a DHT ping packet, and connect to those that responds first. On windows one can only connect to a few peers at a time because of a built in limitation (in XP Service pack 2).

-
-

pop_alert() set_severity_level() wait_for_alert()

+
+

pop_alert() set_severity_level() wait_for_alert()

 std::auto_ptr<alert> pop_alert();
@@ -821,7 +821,7 @@ void set_severity_level(alert::severity_t s);
 

pop_alert() is used to ask the session if any errors or events has occurred. With set_severity_level() you can filter how serious the event has to be for you to -receive it through pop_alert(). For information, see alerts.

+receive it through pop_alert(). For information, 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. @@ -830,8 +830,8 @@ same pointer until the alert is popped by calling < leaving any alert dispatching mechanism independent of this blocking call, the dispatcher can be called and it can pop the alert independently.

-
-

add_extension()

+
+

add_extension()

 void add_extension(boost::function<
@@ -841,7 +841,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. The main plugins implemented in libtorrent are:

+libtorrent plugins. The main plugins implemented in libtorrent are:

metadata extension
Allows peers to download the metadata (.torren files) from the swarm @@ -879,8 +879,8 @@ eliminate most problems on poisoned torrents.
ses.add_extension(&libtorrent::create_smart_ban_plugin);
-
-

set_settings() set_pe_settings()

+
+

set_settings() set_pe_settings()

 void set_settings(session_settings const& settings);
@@ -888,11 +888,11 @@ void set_pe_settings(pe_settings const& settings);
 

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() set_web_seed_proxy() set_tracker_proxy() set_dht_proxy()

+
+

set_peer_proxy() set_web_seed_proxy() set_tracker_proxy() set_dht_proxy()

 void set_peer_proxy(proxy_settings const& s);
@@ -905,16 +905,16 @@ void set_dht_proxy(proxy_settings const& s);
 sets the proxy settings for different kinds of connections, bittorrent peers,
 web seeds, trackers and the DHT traffic.

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.

-
-

peer_proxy() web_seed_proxy() tracker_proxy() dht_proxy()

+
+

peer_proxy() web_seed_proxy() tracker_proxy() dht_proxy()

 proxy_settings const& peer_proxy() const;
@@ -926,8 +926,8 @@ proxy_settings const& dht_proxy() const;
 

These functions returns references to their respective current settings.

The dht_proxy is not available when DHT is disabled.

-
-

start_dht() stop_dht() set_dht_settings() dht_state()

+
+

start_dht() stop_dht() set_dht_settings() dht_state()

 void start_dht(entry const& startup_state);
@@ -987,8 +987,8 @@ that are ready to replace a failing node, it will be replaced immediately,
 this limit is only used to clear out nodes that don't have any node that can
 replace them.

-
-

add_dht_node() add_dht_router()

+
+

add_dht_node() add_dht_router()

 void add_dht_node(std::pair<std::string, int> const& node);
@@ -1006,8 +1006,8 @@ for bootstrapping, to keep the load off them.

An example routing node that you could typically add is router.bittorrent.com.

-
-

start_lsd() stop_lsd()

+
+

start_lsd() stop_lsd()

 void start_lsd();
@@ -1019,8 +1019,8 @@ the infohashes of all the non-private torrents on the local network to
 look for peers on the same swarm within multicast reach.

It is turned off by default.

-
-

start_upnp() stop_upnp()

+
+

start_upnp() stop_upnp()

 upnp* start_upnp();
@@ -1031,12 +1031,12 @@ void stop_upnp();
 port are attempted to be forwarded on local UPnP router devices.

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

+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.

-
-

start_natpmp() stop_natpmp()

+
+

start_natpmp() stop_natpmp()

 natpmp* start_natpmp();
@@ -1047,13 +1047,13 @@ void stop_natpmp();
 port are attempted to be forwarded on the router through NAT-PMP.

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

+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.

-
-

entry

+
+

entry

The entry class represents one node in a bencoded hierarchy. It works as a variant type, it can be either a list, a dictionary (std::map), an integer or a string. This is its synopsis:

@@ -1116,8 +1116,8 @@ public: };

TODO: finish documentation of entry.

-
-

integer() string() list() dict() type()

+
+

integer() string() list() dict() type()

 integer_type& integer();
@@ -1132,7 +1132,7 @@ dictionary_type const& dict() const;
 

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.

@@ -1166,11 +1166,11 @@ 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.

-
-

operator[]

+
+

operator[]

 entry& operator[](char const* key);
@@ -1188,8 +1188,8 @@ given key, a reference to a newly inserted element at that key.

existing element at the given key. If the key is not found, it will throw libtorrent::type_error.

-
-

find_key()

+
+

find_key()

 entry* find_key(char const* key);
@@ -1203,11 +1203,11 @@ element cannot be found, they will return 0. If an element with the given
 key is found, the return a pointer to it.

-
-

torrent_info

+
+

torrent_info

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
@@ -1266,8 +1266,8 @@ public:
         int metadata_size() const;
 };
 
-
-

torrent_info()

+
+

torrent_info()

 torrent_info(sha1_hash const& info_hash);
@@ -1283,25 +1283,25 @@ 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 the constructor, for convenience. This might not be the most suitable for applications that want to be able to report detailed errors on what might go wrong.

-
-

add_tracker()

+
+

add_tracker()

 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().

-
-

files()

+
+

files()

 file_storage const& file() const;
@@ -1315,8 +1315,8 @@ to make its mapping differ from the one in the torrent file.

For more information on the file_storage object, see the separate document on how to create torrents.

-
-

begin_files() end_files() rbegin_files() rend_files()

+
+

begin_files() end_files() rbegin_files() rend_files()

 file_iterator begin_files() const;
@@ -1358,8 +1358,8 @@ the original string is preserved in 
-

num_files() file_at()

+
+

num_files() file_at()

 int num_files() const;
@@ -1369,8 +1369,8 @@ file_entry const& file_at(int index) const;
 

If you need index-access to files you can use the num_files() and file_at() to access files using indices.

-
-

map_block()

+
+

map_block()

 std::vector<file_slice> map_block(int piece, size_type offset
@@ -1395,8 +1395,8 @@ as argument. The offsetsize is the number of bytes this range is. The size + offset
 will never be greater than the file size.

-
-

map_file()

+
+

map_file()

 peer_request map_file(int file_index, size_type file_offset
@@ -1423,8 +1423,8 @@ struct peer_request
 + size is not allowed to be greater than the file size. file_index
 must refer to a valid file, i.e. it cannot be >= num_files().

-
-

url_seeds() add_url_seed()

+
+

url_seeds() add_url_seed()

 std::vector<std::string> const& url_seeds() const;
@@ -1435,10 +1435,10 @@ void add_url_seed(std::string const& url);
 vector of those urls. If you're creating a torrent file, add_url_seed()
 adds one url to the list of url-seeds. Currently, the only transport protocol
 supported for the url is http.

-

See HTTP seeding for more information.

+

See HTTP seeding for more information.

-
-

trackers()

+
+

trackers()

 std::vector<announce_entry> const& trackers() const;
@@ -1457,8 +1457,8 @@ struct announce_entry
 };
 
-
-

total_size() piece_length() piece_size() num_pieces()

+
+

total_size() piece_length() piece_size() num_pieces()

 size_type total_size() const;
@@ -1475,8 +1475,8 @@ the piece index as argument and gives you the exact size of that piece. It will
 be the same as piece_length() except in the case of the last piece, which may
 be smaller.

-
-

hash_for_piece() hash_for_piece_ptr() info_hash()

+
+

hash_for_piece() hash_for_piece_ptr() info_hash()

 size_type piece_size(unsigned int index) const;
@@ -1486,12 +1486,12 @@ char const* hash_for_piece_ptr(unsigned int index) const;
 

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() comment() creation_date() creator()

+
+

name() comment() creation_date() creator()

 std::string const& name() const;
@@ -1501,15 +1501,15 @@ boost::optional<boost::posix_time::ptime> creation_date() const;
 

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.

creator() returns the creator string in the torrent. If there is no creator string it will return an empty string.

-
-

priv()

+
+

priv()

 bool priv() const;
@@ -1518,8 +1518,8 @@ bool priv() const;
 

priv() returns true if this torrent is private. i.e., it should not be distributed on the trackerless network (the kademlia DHT).

-
-

nodes()

+
+

nodes()

 std::vector<std::pair<std::string, int> > const& nodes() const;
@@ -1528,8 +1528,8 @@ std::vector<std::pair<std::string, int> > const& nodes() const;
 

If this torrent contains any DHT nodes, they are put in this vector in their original form (host name and port number).

-
-

add_node()

+
+

add_node()

 void add_node(std::pair<std::string, int> const& node);
@@ -1538,8 +1538,8 @@ void add_node(std::pair<std::string, int> const& node);
 

This is used when creating torrent. Use this to add a known DHT node. It may be used, by the client, to bootstrap into the DHT network.

-
-

metadata() metadata_size()

+
+

metadata() metadata_size()

 boost::shared_array<char> metadata() const;
@@ -1550,8 +1550,8 @@ int metadata_size() const;
 of the metadata is returned by metadata_size().

-
-

torrent_handle

+
+

torrent_handle

You will usually have to store your torrent handles somewhere, since it's the object through which you retrieve information about the torrent and aborts the torrent. Its declaration looks like this:

@@ -1642,14 +1642,14 @@ 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 guarantee that a handle will remain valid between two calls.

-
-

piece_priority() prioritize_pieces() piece_priorities() prioritize_files()

+
+

piece_priority() prioritize_pieces() piece_priorities() prioritize_files()

 void piece_priority(int index, int priority) const;
@@ -1693,8 +1693,8 @@ torrent. Each element is the current priority of that piece.

files in the torrent. Each entry is the priority of that file. The function sets the priorities of all the pieces in the torrent based on the vector.

-
-

file_progress()

+
+

file_progress()

 void file_progress(std::vector<float>& fp);
@@ -1702,21 +1702,21 @@ void file_progress(std::vector<float>& fp);
 

This function fills in the supplied vector with the progress (a value in the range [0, 1]) describing the download progress of each file in this torrent. -The progress values are ordered the same as the files in the torrent_info. +The progress values are ordered the same as the files in the torrent_info. This operation is not very cheap.

-
-

save_path()

+
+

save_path()

 boost::filesystem::path save_path() const;
 
-

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.

-
-

move_storage()

+
+

move_storage()

 void move_storage(boost::filesystem::path const& save_path) const;
@@ -1728,8 +1728,8 @@ the same drive as the original save path. Since disk IO is performed in a separa
 thread, this operation is also asynchronous. Once the operation completes, the
 storage_moved_alert is generated, with the new path as the message.

-
-

force_reannounce()

+
+

force_reannounce()

 void force_reannounce() const;
@@ -1740,8 +1740,8 @@ void force_reannounce(boost::posix_time::time_duration) const;
 peers. The second overload of force_reannounce that takes a time_duration as
 argument will schedule a reannounce in that amount of time from now.

-
-

scrape_tracker()

+
+

scrape_tracker()

 void scrape_tracker() const;
@@ -1751,11 +1751,11 @@ void scrape_tracker() const;
 tracker for statistics such as total number of incomplete peers, complete peers, number of
 downloads etc.

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.

-
-

connect_peer()

+
+

connect_peer()

 void connect_peer(asio::ip::tcp::endpoint const& adr, int source = 0) const;
@@ -1765,12 +1765,12 @@ void connect_peer(asio::ip::tcp::endpoint const& adr, int source = 0) const;
 torrent. If the peer does not respond, or is not a member of this torrent, it will simply
 be disconnected. No harm can be done by using this other than an unnecessary connection
 attempt is made. If the torrent is uninitialized or in queued or checking mode, this
-will throw invalid_handle. The second (optional) argument will be bitwised ORed into
-the source mask of this peer. Typically this is one of the source flags in peer_info.
+will throw invalid_handle. The second (optional) argument will be bitwised ORed into
+the source mask of this peer. Typically this is one of the source flags in peer_info.
 i.e. tracker, pex, dht etc.

-
-

name()

+
+

name()

 std::string name() const;
@@ -1780,8 +1780,8 @@ std::string name() const;
 case the torrent was started without metadata, and hasn't completely received it yet,
 it returns the name given to it when added to the session. See session::add_torrent.

-
-

set_ratio()

+
+

set_ratio()

 void set_ratio(float ratio) const;
@@ -1795,8 +1795,8 @@ attempt to upload in return for each download. e.g. if set to 2, the client will
 2 bytes for every byte received. The default setting for this is 0, which will make it work
 as a standard client.

-
-

set_upload_limit() set_download_limit() upload_limit() download_limit()

+
+

set_upload_limit() set_download_limit() upload_limit() download_limit()

 void set_upload_limit(int limit) const;
@@ -1814,8 +1814,8 @@ limit.

upload_limit and download_limit will return the current limit setting, for upload and download, respectively.

-
-

set_sequential_download()

+
+

set_sequential_download()

 void set_sequential_download(bool sd);
@@ -1826,8 +1826,8 @@ instead of rarest first.

Enabling sequential download will affect the piece distribution negatively in the swarm. It should be used sparingly.

-
-

set_peer_upload_limit() set_peer_download_limit()

+
+

set_peer_upload_limit() set_peer_download_limit()

 void set_peer_upload_limit(asio::ip::tcp::endpoint ip, int limit) const;
@@ -1837,8 +1837,8 @@ void set_peer_download_limit(asio::ip::tcp::endpoint ip, int limit) const;
 

Works like set_upload_limit and set_download_limit respectively, but controls individual peer instead of the whole torrent.

-
-

pause() resume() is_paused()

+
+

pause() resume() is_paused()

 void pause() const;
@@ -1850,10 +1850,10 @@ bool is_paused() const;
 When a torrent is paused, it will however remember all share ratios to all peers and remember
 all potential (not connected) peers. You can use is_paused() to determine if a torrent
 is currently paused. Torrents may be paused automatically if there is a file error (e.g. disk full)
-or something similar. See file_error_alert.

+or something similar. See file_error_alert.

-
-

resolve_countries()

+
+

resolve_countries()

 void resolve_countries(bool r);
@@ -1861,12 +1861,12 @@ 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_seed()

+
+

is_seed()

 bool is_seed() const;
@@ -1874,8 +1874,8 @@ bool is_seed() const;
 

Returns true if the torrent is in seed mode (i.e. if it has finished downloading).

-
-

is_auto_managed() auto_managed()

+
+

is_auto_managed() auto_managed()

 bool is_auto_managed() const;
@@ -1884,10 +1884,10 @@ void auto_managed(bool m) const;
 

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()

+
+

has_metadata()

 bool has_metadata() const;
@@ -1896,10 +1896,10 @@ bool has_metadata() const;
 

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 throw.

+doesn't have metadata, the member get_torrent_info() will throw.

-
-

set_tracker_login()

+
+

set_tracker_login()

 void set_tracker_login(std::string const& username
@@ -1909,8 +1909,8 @@ void set_tracker_login(std::string const& username
 

set_tracker_login() sets a username and password that will be sent along in the HTTP-request of the tracker announce. Set this if the tracker requires authorization.

-
-

trackers() replace_trackers()

+
+

trackers() replace_trackers()

 std::vector<announce_entry> const& trackers() const;
@@ -1924,10 +1924,10 @@ 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_url_seed() remove_url_seed() url_seeds()

+
+

add_url_seed() remove_url_seed() url_seeds()

 void add_url_seed(std::string const& url);
@@ -1942,10 +1942,10 @@ 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.

-
-

queue_position() queue_position_up() queue_position_down() queue_position_top() queue_position_bottom()

+
+

queue_position() queue_position_up() queue_position_down() queue_position_top() queue_position_bottom()

 int queue_position() const;
@@ -1967,20 +1967,20 @@ the closer the torrent is to the front of the line to be started.

closer to the front and down means closer to the back of the queue. Top and bottom refers to the front and the back of the queue respectively.

-
-

use_interface()

+
+

use_interface()

 void use_interface(char const* net_interface) const;
 

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.

-
-

info_hash()

+
+

info_hash()

 sha1_hash info_hash() const;
@@ -1988,8 +1988,8 @@ sha1_hash info_hash() const;
 

info_hash() returns the info-hash for the torrent.

-
-

set_max_uploads() set_max_connections()

+
+

set_max_uploads() set_max_connections()

 void set_max_uploads(int max_uploads) const;
@@ -2003,17 +2003,17 @@ connections are used up, incoming connections may be refused or poor connections
 This must be at least 2. The default is unlimited number of connections. If -1 is given to the
 function, it means unlimited.

-
-

save_resume_data()

+
+

save_resume_data()

 void save_resume_data() const;
 
-

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:

    @@ -2021,19 +2021,19 @@ 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 torrent, 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. Only pause the torrent before you save the 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. Only pause the torrent before you save the resume data if you will remove the torrent afterwards. There's no need to pause when saving intermittent resume data.

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 the entire file.

@@ -2078,19 +2078,19 @@ while (num_resume_data > 0) }
-
-

status()

+
+

status()

 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_download_queue()

+
+

get_download_queue()

 void get_download_queue(std::vector<partial_piece_info>& queue) const;
@@ -2142,8 +2142,8 @@ a state (state) which
 is 0 or 1, but at the end of the torrent blocks may be requested by more peers in parallel to
 speed things up.

-
-

get_peer_info()

+
+

get_peer_info()

 void get_peer_info(std::vector<peer_info>&) const;
@@ -2151,25 +2151,25 @@ void get_peer_info(std::vector<peer_info>&) const;
 

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.

-
-

get_torrent_info()

+
+

get_torrent_info()

 torrent_info const& get_torrent_info() const;
 
-

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 +

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.

-
-

is_valid()

+
+

is_valid()

 bool is_valid() const;
@@ -2179,12 +2179,12 @@ 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.

-
-

torrent_status

+
+

torrent_status

It contains the following fields:

 struct torrent_status
@@ -2267,6 +2267,8 @@ struct torrent_status
         int seed_rank;
 
         int last_scrape;
+
+        bool has_incoming;
 };
 

progress is a value in the range [0, 1], that represents the progress of the @@ -2360,7 +2362,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 @@ -2398,7 +2400,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 @@ -2408,7 +2410,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 @@ -2425,12 +2427,14 @@ 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.

+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 +to this torrent.'

-
-

peer_info

+
+

peer_info

It contains the following fields:

 struct peer_info
@@ -2555,7 +2559,7 @@ any combination of the enums above. The following table describes each flag:

support_extensions means that this peer supports the -extension protocol. +extension protocol. local_connection The connection was initiated by us, the peer has a @@ -2671,7 +2675,7 @@ limits.

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. @@ -2699,12 +2703,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.

@@ -2749,8 +2753,8 @@ estimated by timing the the tcp c rates seen on this connection. They are given in bytes per second. This number is reset to 0 on reconnect.

-
-

session_settings

+
+

session_settings

You have some control over tracker requests through the session_settings object. You create it and fill it with your settings and then use session::set_settings() to apply them. You have control over proxy and authorization settings and also the user-agent @@ -2942,9 +2946,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 @@ -2972,7 +2976,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. Seeding torrents are counted against the downloads limit but downloading torrenst are not @@ -2980,12 +2984,12 @@ counted against the seed limit.

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 @@ -3006,8 +3010,8 @@ Peers are evicted from the cache when the list grows passed 90% of this limit, and once the size hits the limit, peers are no longer added to the list.

-
-

pe_settings

+
+

pe_settings

The pe_settings structure is used to control the settings related to peer protocol encryption:

@@ -3063,8 +3067,8 @@ remains unchanged.
 
 

prefer_rc4 can be set to true if you want to prefer the RC4 encrypted stream.

-
-

proxy_settings

+
+

proxy_settings

The proxy_settings structs contains the information needed to direct certain traffic to a proxy.

@@ -3102,16 +3106,16 @@ options are available:

  • none - This is the default, no proxy server is used, all other fields are ignored.
  • -
  • socks4 - The server is assumed to be a SOCKS4 server that +
  • socks4 - The server is assumed to be a SOCKS4 server that requires a username.
  • -
  • socks5 - The server is assumed to be a SOCKS5 server (RFC 1928) that +
  • socks5 - The server is assumed to be a SOCKS5 server (RFC 1928) that does not require any authentication. The username and password are ignored.
  • socks5_pw - The server is assumed to be a SOCKS5 server that supports -plain text username and password authentication (RFC 1929). The username +plain text username and password authentication (RFC 1929). The username and password specified may be sent to the proxy if it requires.
  • http - The server is assumed to be an HTTP proxy. If the transport used for the connection is non-HTTP, the server is assumed to support the -CONNECT method. i.e. for web seeds and HTTP trackers, a plain proxy will +CONNECT method. i.e. for web seeds and HTTP trackers, a plain proxy will suffice. The proxy is assumed to not require authorization. The username and password will not be used.
  • http_pw - The server is assumed to be an HTTP proxy that requires @@ -3119,8 +3123,8 @@ user authorization. The username and password will be sent to the proxy.
-
-

ip_filter

+
+

ip_filter

The ip_filter class is a set of rules that uniquely categorizes all ip addresses as allowed or disallowed. The default constructor creates a single rule that allows all addresses (0.0.0.0 - 255.255.255.255 for @@ -3152,8 +3156,8 @@ public: }; -

-

ip_filter()

+
+

ip_filter()

 ip_filter()
@@ -3163,8 +3167,8 @@ ip_filter()
 

postcondition: access(x) == 0 for every x

-
-

add_rule()

+
+

add_rule()

 void add_rule(address first, address last, int flags);
@@ -3181,8 +3185,8 @@ means disallowed.

This means that in a case of overlapping ranges, the last one applied takes precedence.

-
-

access()

+
+

access()

 int access(address const& addr) const;
@@ -3193,8 +3197,8 @@ can currently be 0 or ip_filter::
 is O(log n), where n is the minimum number of non-overlapping ranges to describe
 the current filter.

-
-

export_filter()

+
+

export_filter()

 boost::tuple<std::vector<ip_range<address_v4> >
@@ -3209,8 +3213,8 @@ entry in the returned vector is a range with the access control specified in its
 and one for IPv6 addresses.

-
-

big_number

+
+

big_number

Both the peer_id and sha1_hash types are typedefs of the class big_number. It represents 20 bytes of data. Its synopsis follows:

@@ -3230,8 +3234,8 @@ public:
 

The iterators gives you access to individual bytes.

-
-

hasher

+
+

hasher

This class creates sha1-hashes. Its declaration looks like this:

 class hasher
@@ -3257,8 +3261,8 @@ call reset() to reini
 

The sha1-algorithm used was implemented by Steve Reid and released as public domain. For more info, see src/sha1.cpp.

-
-

fingerprint

+
+

fingerprint

The fingerprint class represents information about a client and its version. It is used to encode this information into the client's peer id.

This is the class declaration:

@@ -3315,13 +3319,13 @@ sure not to clash with anybody else. Here are some taken id's:

-

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.

-
-

UPnP and NAT-PMP

+
+

UPnP and NAT-PMP

The upnp and natpmp classes contains the state for all UPnP and NAT-PMP mappings, by default 1 or two mappings are made by libtorrent, one for the listen port and one for the DHT port (UDP).

@@ -3354,8 +3358,8 @@ public:

discover_device(), close() and rebind() are for internal uses and should not be called directly by clients.

-
-

add_mapping

+
+

add_mapping

 int add_mapping(protocol_type p, int external_port, int local_port);
@@ -3366,28 +3370,28 @@ 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.

-
-

delete_mapping

+
+

delete_mapping

 void delete_mapping(int mapping_index);
 

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.

-
-

router_model()

+
+

router_model()

 std::string router_model();
@@ -3397,10 +3401,10 @@ std::string router_model();
 the router, it can be queried through this function.

-
-

free functions

-
-

identify_client()

+
+

free functions

+
+

identify_client()

 std::string identify_client(peer_id const& id);
@@ -3410,8 +3414,8 @@ std::string identify_client(peer_id const& id);
 to extract a string describing a client version from its peer-id. It will recognize most clients
 that have this kind of identification in the peer-id.

-
-

client_fingerprint()

+
+

client_fingerprint()

 boost::optional<fingerprint> client_fingerprint(peer_id const& p);
@@ -3422,23 +3426,23 @@ to automate the identification of clients. It will not be able to identify peers
 standard encodings. Only Azureus style, Shadow's style and Mainline style. This function is
 declared in the header <libtorrent/identify_client.hpp>.

-
-

bdecode() bencode()

+
+

bdecode() bencode()

 template<class InIt> entry bdecode(InIt start, InIt end);
 template<class OutIt> void bencode(OutIt out, const entry& e);
 
-

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:

@@ -3458,13 +3462,13 @@ 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.

-
-

alerts

+
+

alerts

The pop_alert() function on session is the interface for retrieving alerts, warnings, messages and errors from libtorrent. If there hasn't occurred any errors (matching your severity level) pop_alert() will @@ -3521,7 +3525,7 @@ any events at all.

pop_alert() from time to time. If you don't do that, the alert queue will just grow.

When you get an alert, you can use typeid() or dynamic_cast<> to get more detailed information on exactly which type it is. i.e. what kind of error it is. You can also use a -dispatcher mechanism that's available in libtorrent.

+dispatcher mechanism that's available in libtorrent.

All alert types are defined in the <libtorrent/alert_types.hpp> header file.

The alert class is the base class that specific messages are derived from. This is its synopsis:

@@ -3555,8 +3559,8 @@ struct torrent_alert: alert };

The specific alerts, that all derives from alert, are:

-
-

external_ip_alert

+
+

external_ip_alert

Whenever libtorrent learns about the machines external IP, this alert is generated. The external IP address can be acquired from the tracker (if it supports that) or from peers that supports the extension protocol. @@ -3571,10 +3575,10 @@ struct external_ip_alert: alert };

-
-

listen_failed_alert

+
+

listen_failed_alert

This alert is generated when none of the ports, given in the port range, to -session can be opened for listening. This alert is generated as severity +session can be opened for listening. This alert is generated as severity level fatal.

 struct listen_failed_alert: alert
@@ -3584,8 +3588,8 @@ struct listen_failed_alert: alert
 };
 
-
-

portmap_error_alert

+
+

portmap_error_alert

This alert is generated when a NAT router was successfully found but some part of the port mapping request failed. It contains a text message that may help the user figure out what is wrong. This alert is not generated in @@ -3595,7 +3599,7 @@ mappings.

The alert is generated as severity warning, since it should be displayed to the user somehow, and could mean reduced preformance.

mapping refers to the mapping index of the port map that failed, i.e. -the index returned from add_mapping.

+the index returned from add_mapping.

type is 0 for NAT-PMP and 1 for UPnP.

 struct portmap_error_alert: alert
@@ -3607,15 +3611,15 @@ struct portmap_error_alert: alert
 };
 
-
-

portmap_alert

+
+

portmap_alert

This alert is generated when a NAT router was successfully found and a port was successfully mapped on it. On a NAT:ed network with a NAT-PMP capable router, this is typically generated once when mapping the TCP port and, if DHT is enabled, when the UDP port is mapped. This is merely an informational alert, and is generated at severity level info.

mapping refers to the mapping index of the port map that failed, i.e. -the index returned from add_mapping.

+the index returned from add_mapping.

external_port is the external port allocated for the mapping.

type is 0 for NAT-PMP and 1 for UPnP.

@@ -3629,8 +3633,8 @@ struct portmap_alert: alert
 };
 
-
-

file_error_alert

+
+

file_error_alert

If the storage fails to read or write files that it needs access to, this alert is generated and the torrent is paused. It is generated as severity level fatal.

@@ -3644,8 +3648,8 @@ struct file_error_alert: torrent_alert
 };
 
-
-

tracker_announce_alert

+
+

tracker_announce_alert

This alert is generated each time a tracker announce is sent (or attempted to be sent). It is generated at severity level info.

@@ -3659,8 +3663,8 @@ struct tracker_announce_alert: torrent_alert
 };
 
-
-

tracker_alert

+
+

tracker_alert

This is a base class for all alerts related to trackers.

 struct tracker_alert: torrent_alert
@@ -3674,8 +3678,8 @@ struct tracker_alert: torrent_alert
 };
 
-
-

tracker_error_alert

+
+

tracker_error_alert

This alert is generated on tracker time outs, premature disconnects, invalid response or a HTTP response other than "200 OK". From the alert you can get the handle to the torrent the tracker belongs to. This alert is generated as severity level warning.

@@ -3695,8 +3699,8 @@ struct tracker_error_alert: tracker_alert };
-
-

tracker_reply_alert

+
+

tracker_reply_alert

This alert is only for informational purpose. It is generated when a tracker announce succeeds. It is generated regardless what kind of tracker was used, be it UDP, HTTP or the DHT. It is generated with severity level info.

@@ -3716,8 +3720,8 @@ struct tracker_reply_alert: tracker_alert

The num_peers tells how many peers were returned from the tracker. This is not necessarily all new peers, some of them may already be connected.

-
-

tracker_warning_alert

+
+

tracker_warning_alert

This alert is triggered if the tracker reply contains a warning field. Usually this means that the tracker announce was successful, but the tracker has a message to the client. The message string in the alert will contain the warning message from @@ -3733,8 +3737,8 @@ struct tracker_warning_alert: tracker_alert };

-
-

scrape_reply_alert

+
+

scrape_reply_alert

 struct scrape_reply_alert: tracker_alert
 {
@@ -3754,8 +3758,8 @@ struct scrape_reply_alert: tracker_alert
 and complete is the data returned in the scrape response. These numbers
 may be -1 if the reponse was malformed.

-
-

scrape_failed_alert

+
+

scrape_failed_alert

 struct scrape_failed_alert: tracker_alert
 {
@@ -3770,8 +3774,8 @@ struct scrape_failed_alert: tracker_alert
 to the tracker timing out, refusing connection or returning an http response
 code indicating an error.

-
-

url_seed_alert

+
+

url_seed_alert

This alert is generated when a HTTP seed name lookup fails. This alert is generated as severity level warning.

It contains url to the HTTP seed that failed along with an error message.

@@ -3786,8 +3790,8 @@ struct url_seed_alert: torrent_alert };
-
-

hash_failed_alert

+
+

hash_failed_alert

This alert is generated when a finished piece fails its hash check. You can get the handle to the torrent which got the failed piece and the index of the piece itself from the alert. This alert is generated as severity level info.

@@ -3805,10 +3809,10 @@ struct hash_failed_alert: torrent_alert };
-
-

peer_ban_alert

+
+

peer_ban_alert

This alert is generated when a peer is banned because it has sent too many corrupt pieces -to us. It is generated at severity level info. The handle member is a torrent_handle +to us. It is generated at severity level info. The handle member is a torrent_handle to the torrent that this peer was a member of.

 struct peer_ban_alert: torrent_alert
@@ -3824,8 +3828,8 @@ struct peer_ban_alert: torrent_alert
 };
 
-
-

peer_error_alert

+
+

peer_error_alert

This alert is generated when a peer sends invalid data over the peer-peer protocol. The peer will be disconnected, but you get its ip address from the alert, to identify it. This alert is generated as severity level debug.

@@ -3843,8 +3847,8 @@ struct peer_error_alert: alert };
-
-

invalid_request_alert

+
+

invalid_request_alert

This is a debug alert that is generated by an incoming invalid piece request. The handle is a handle to the torrent the peer is a member of. ìp is the address of the peer and the request is the actual incoming request from the peer. The alert is generated as severity level @@ -3879,8 +3883,8 @@ struct peer_request the index of the piece it want data from, start is the offset within the piece where the data should be read, and length is the amount of data it wants.

-
-

torrent_finished_alert

+
+

torrent_finished_alert

This alert is generated when a torrent switches from being a downloader to a seed. It will only be generated once per torrent. It contains a torrent_handle to the torrent in question. This alert is generated as severity level info.

@@ -3895,8 +3899,8 @@ struct torrent_finished_alert: torrent_alert };
-
-

metadata_failed_alert

+
+

metadata_failed_alert

This alert is generated when the metadata has been completely received and the info-hash failed to match it. i.e. the metadata that was received was corrupt. libtorrent will automatically retry to fetch it in this case. This is only relevant when running a @@ -3913,8 +3917,8 @@ struct metadata_failed_alert: torrent_alert };

-
-

metadata_received_alert

+
+

metadata_received_alert

This alert is generated when the metadata has been completely received and the torrent can start downloading. It is not generated on torrents that are started with metadata, but only those that needs to download it from peers (when utilizing the libtorrent extension). @@ -3930,8 +3934,8 @@ struct metadata_received_alert: torrent_alert };

-
-

fastresume_rejected_alert

+
+

fastresume_rejected_alert

This alert is generated when a fastresume file has been passed to add_torrent but the files on disk did not match the fastresume file. The string explains the reason why the resume file was rejected. It is generated at severity level warning.

@@ -3945,8 +3949,8 @@ struct fastresume_rejected_alert: torrent_alert };
-
-

peer_blocked_alert

+
+

peer_blocked_alert

This alert is generated when a peer is blocked by the IP filter. It has the severity leve info. The ip member is the address that was blocked.

@@ -3961,8 +3965,8 @@ struct peer_blocked_alert: alert
 };
 
-
-

storage_moved_alert

+
+

storage_moved_alert

The storage_moved_alert is generated when all the disk IO has completed and the files have been moved, as an effect of a call to torrent_handle::move_storage. This is useful to synchronize with the actual disk.

@@ -3974,8 +3978,8 @@ struct storage_moved_alert: torrent_alert };
-
-

torrent_paused_alert

+
+

torrent_paused_alert

This alert is generated as a response to a torrent_handle::pause request. It is generated once all disk IO is complete and the files in the torrent have been closed. This is useful for synchronizing with the disk.

@@ -3987,8 +3991,8 @@ struct torrent_paused_alert: torrent_alert };
-
-

save_resume_data_alert

+
+

save_resume_data_alert

This alert is generated as a response to a torrent_handle::save_resume_data request. It is generated once the disk IO thread is done writing the state for this torrent. The resume_data member points to the resume data or is 0 on errors.

@@ -4003,8 +4007,8 @@ struct save_resume_data_alert: torrent_alert };
-
-

dispatcher

+
+

dispatcher

The handle_alert class is defined in <libtorrent/alert.hpp>.

Examples usage:

@@ -4049,13 +4053,13 @@ parameters to select between more types. If the number of types are more than
 including <libtorrent/alert.hpp>.

-
-

exceptions

+
+

exceptions

There are a number of exceptions that can be thrown from different places in libtorrent, here's a complete list with description.

-
-

invalid_handle

-

This exception is thrown when querying information from a torrent_handle that hasn't +

+

invalid_handle

+

This exception is thrown when querying information from a torrent_handle that hasn't been initialized or that has become invalid.

 struct invalid_handle: std::exception
@@ -4064,10 +4068,10 @@ struct invalid_handle: std::exception
 };
 
-
-

duplicate_torrent

-

This is thrown by add_torrent() if the torrent already has been added to -the session. Since remove_torrent() is asynchronous, this exception may +

+

duplicate_torrent

+

This is thrown by add_torrent() if the torrent already has been added to +the session. Since remove_torrent() is asynchronous, this exception may be thrown if the torrent is removed and then immediately added again.

 struct duplicate_torrent: std::exception
@@ -4076,8 +4080,8 @@ struct duplicate_torrent: std::exception
 };
 
-
-

invalid_encoding

+
+

invalid_encoding

This is thrown by bdecode() if the input data is not a valid bencoding.

 struct invalid_encoding: std::exception
@@ -4086,8 +4090,8 @@ struct invalid_encoding: std::exception
 };
 
-
-

type_error

+
+

type_error

This is thrown from the accessors of entry if the data type of the entry doesn't match the type you want to extract from it.

@@ -4097,8 +4101,8 @@ struct type_error: std::runtime_error
 };
 
-
-

invalid_torrent_file

+
+

invalid_torrent_file

This exception is thrown from the constructor of torrent_info if the given bencoded information doesn't meet the requirements on what information has to be present in a torrent file.

@@ -4109,8 +4113,8 @@ struct invalid_torrent_file: std::exception
 
-
-

storage_interface

+
+

storage_interface

The storage interface is a pure virtual class that can be implemented to change the behavior of the actual file storage. The interface looks like this:

@@ -4132,8 +4136,8 @@ struct storage_interface virtual ~storage_interface() {} }; -
-

initialize()

+
+

initialize()

 void initialize(bool allocate_files) = 0;
@@ -4143,8 +4147,8 @@ void initialize(bool allocate_files) = 0;
 will create directories and empty files at this point. If allocate_files is true,
 it will also ftruncate all files to their target size.

-
-

read()

+
+

read()

 size_type read(char* buf, int slot, int offset, int size) = 0;
@@ -4154,8 +4158,8 @@ size_type read(char* buf, int slot, int offset, int size) = 0;
 and size number of bytes. The data is to be copied to buf.

The return value is the number of bytes actually read.

-
-

write()

+
+

write()

 void write(const char* buf, int slot, int offset, int size) = 0;
@@ -4164,8 +4168,8 @@ void write(const char* buf, int slot, int offset, int size) = 0;
 

This function should write the data in buf to the given slot (slot) at offset offset in that slot. The buffer size is size.

-
-

move_storage()

+
+

move_storage()

 bool move_storage(fs::path save_path) = 0;
@@ -4176,8 +4180,8 @@ The default storage moves the single file or the directory of the torrent.

Before moving the files, any open file handles may have to be closed, like release_files().

-
-

verify_resume_data()

+
+

verify_resume_data()

 bool verify_resume_data(entry& rd, std::string& error) = 0;
@@ -4188,8 +4192,8 @@ on disk. If the resume data seems to be up-to-date, return true. If
 not, set error to a description of what mismatched and return false.

The default storage may compare file sizes and time stamps of the files.

-
-

write_resume_data()

+
+

write_resume_data()

 void write_resume_data(entry& rd) const = 0;
@@ -4199,8 +4203,8 @@ void write_resume_data(entry& rd) const = 0;
 storage, in rd. The default storage adds file timestamps and
 sizes.

-
-

move_slot()

+
+

move_slot()

 void move_slot(int src_slot, int dst_slot) = 0;
@@ -4211,8 +4215,8 @@ the slot dst_slot. Th
 

If the storage caches slots, this could be implemented more efficient than reading and writing the data.

-
-

swap_slots()

+
+

swap_slots()

 void swap_slots(int slot1, int slot2) = 0;
@@ -4223,8 +4227,8 @@ storage uses a scratch buffer to read the data into, then moving the other
 slot and finally writing back the temporary slot's data

This is only used in compact mode.

-
-

swap_slots3()

+
+

swap_slots3()

 void swap_slots3(int slot1, int slot2, int slot3) = 0;
@@ -4235,8 +4239,8 @@ should move to slot2,
 should be moved to slot1.

This is only used in compact mode.

-
-

hash_for_slot()

+
+

hash_for_slot()

 sha1_hash hash_for_slot(int slot, partial_hash& h, int piece_size) = 0;
@@ -4257,8 +4261,8 @@ struct partial_hash
 that is stored in the given slot.

The function should return the hash of the piece stored in the slot.

-
-

release_files()

+
+

release_files()

 void release_files() = 0;
@@ -4268,8 +4272,8 @@ void release_files() = 0;
 belonging to this storage. The default implementation just calls
 file_pool::release_files(this).

-
-

delete_files()

+
+

delete_files()

 void delete_files() = 0;
@@ -4278,16 +4282,16 @@ void delete_files() = 0;
 

This function should delete all files and directories belonging to this storage.

-
-

queuing

+
+

queuing

libtorrent supports queuing. Which means it makes sure that a limited number of torrents are being downloaded at any given time, and once a torrent is completely downloaded, the next in line is started.

Torrents that are auto managed are subject to the queuing and the active torrents limits. To make a torrent auto managed, set auto_managed to true when adding the -torrent (see add_torrent()).

+torrent (see add_torrent()).

The limits of the number of downloading and seeding torrents are controlled via -active_downloads and active_seeds in session_settings. These limits takes +active_downloads and active_seeds in session_settings. These limits takes non auto managed torrents into account as well. If there are are more non-auto managed torrents being downloaded than the active_downloads setting, any auto managed torrents will be queued until torrents are removed so that the number drops below @@ -4297,11 +4301,11 @@ seeding. So, active_downloads

At a regular interval, torrents are checked if there needs to be any re-ordering of which torrents are active and which are queued. This interval can be controlled via -auto_manage_interval in session_settings. It defaults to every 30 seconds.

+auto_manage_interval in session_settings. It defaults to every 30 seconds.

For queuing to work, resume data needs to be saved and restored for all torrents. -See save_resume_data().

-
-

downloading

+See save_resume_data().

+
+

downloading

Torrents that are currently being downloaded or incomplete (with bytes still to download) are queued. The torrents in the front of the queue are started to be actively downloaded and the rest are ordered with regards to their queue position. Any newly added torrent @@ -4312,35 +4316,35 @@ position in order to fill the gap.

Lower queue position means closer to the front of the queue, and will be started sooner than torrents with higher queue positions.

To query a torrent for its position in the queue, or change its position, see: -queue_position() queue_position_up() queue_position_down() queue_position_top() queue_position_bottom().

+queue_position() queue_position_up() queue_position_down() queue_position_top() queue_position_bottom().

-
-

seeding

+
+

seeding

Auto managed seeding torrents are rotated, so that all of them are allocated a fair amount of seeding. Torrents with fewer completed seed cycles are prioritized for seeding. A seed cycle is completed when a torrent meets either the share ratio limit (uploaded bytes / downloaded bytes), the share time ratio (time seeding / time downloaing) or seed time limit (time seeded).

The relevant settings to control these limits are share_ratio_limit, -seed_time_ratio_limit and seed_time_limit in session_settings.

+seed_time_ratio_limit and seed_time_limit in session_settings.

-
-

fast resume

+
+

fast resume

The fast resume mechanism is a way to remember which pieces are downloaded and where they are put between sessions. You can generate fast resume data by -calling save_resume_data() on torrent_handle. You can +calling save_resume_data() on torrent_handle. You can then save this data to disk and use it when resuming the torrent. libtorrent will not check the piece hashes then, and rely on the information given in the fast-resume data. The fast-resume data also contains information about which blocks, in the unfinished pieces, were downloaded, so it will not have to start from scratch on the partially downloaded pieces.

-

To use the fast-resume data you simply give it to add_torrent(), and it +

To use the fast-resume data you simply give it to add_torrent(), and it will skip the time consuming checks. It may have to do the checking anyway, if the fast-resume data is corrupt or doesn't fit the storage for that torrent, then it will not trust the fast-resume data and just do the checking.

-
-

file format

+
+

file format

The file format is a bencoded dictionary containing the following fields:

@@ -4449,8 +4453,8 @@ last resume data checkpoint.
-
-

threads

+
+

threads

libtorrent starts 2 or 3 threads.

    @@ -4468,8 +4472,8 @@ non-blocking host name resolution to simulate non-blocking behavior.
-
-

storage allocation

+
+

storage allocation

There are three modes in which storage (files on disk) are allocated in libtorrent.

  1. The traditional full allocation mode, where the entire files are filled up with @@ -4483,11 +4487,11 @@ pieces that have been downloaded. This is the default allocation mode in libtorr to where they belong. This is the recommended (and default) mode.

The allocation mode is selected when a torrent is started. It is passed as an -argument to session::add_torrent() (see add_torrent()).

+argument to session::add_torrent() (see add_torrent()).

The decision to use full allocation or compact allocation typically depends on whether any files are filtered and if the filesystem supports sparse files.

-
-

sparse allocation

+
+

sparse allocation

On filesystems that supports sparse files, this allocation mode will only use as much space as has been downloaded.

@@ -4498,9 +4502,9 @@ as much space as has been downloaded.

-
-

full allocation

-

When a torrent is started in full allocation mode, the checker thread (see threads) +

+

full allocation

+

When a torrent is started in full allocation mode, the checker thread (see threads) will make sure that the entire storage is allocated, and fill any gaps with zeros. This will be skipped if the filesystem supports sparse files or automatic zero filling. It will of course still check for existing pieces and fast resume data. The main @@ -4530,8 +4534,8 @@ out of date data, since pieces won't move around.

-
-

compact allocation

+
+

compact allocation

The compact allocation will only allocate as much storage as it needs to keep the pieces downloaded so far. This means that pieces will be moved around to be placed at their final position in the files while downloading (to make sure the completed @@ -4579,9 +4583,9 @@ contain any piece), return that slot index.

-
-

extensions

-

These extensions all operates within the extension protocol. The +

+

extensions

+

These extensions all operates within the extension protocol. The name of the extension is the name used in the extension-list packets, and the payload is the data in the extended message (not counting the length-prefix, message-id nor extension-id).

@@ -4589,8 +4593,8 @@ length-prefix, message-id nor extension-id).

handshake, it may be incompatible with future versions of the mainline bittorrent client.

These are the extensions that are currently implemented.

-
-

metadata from peers

+
+

metadata from peers

Extension name: "LT_metadata"

The point with this extension is that you don't have to distribute the metadata (.torrent-file) separately. The metadata can be distributed @@ -4708,9 +4712,9 @@ doesn't have any metadata.

-
-

HTTP seeding

-

The HTTP seed extension implements this specification.

+
+

HTTP seeding

+

The HTTP seed extension implements this specification.

The libtorrent implementation assumes that, if the URL ends with a slash ('/'), the filename should be appended to it in order to request pieces from that file. The way this works is that if the torrent is a single-file torrent, @@ -4719,8 +4723,8 @@ torrent's name '/' the file name is appended. This is the same directory structure that libtorrent will download torrents into.

-
-

filename checks

+
+

filename checks

Boost.Filesystem will by default check all its paths to make sure they conform to filename requirements on many platforms. If you don't want this check, you can set it to either only check for native filesystem requirements or turn it off @@ -4728,19 +4732,19 @@ altogether. You can use:

 boost::filesystem::path::default_name_check(boost::filesystem::native);
 
-

for example. For more information, see the Boost.Filesystem docs.

+

for example. For more information, see the Boost.Filesystem docs.

-
-

acknowledgments

+
+

acknowledgments

Written by Arvid Norberg. Copyright © 2003-2006

Contributions by Magnus Jonsson, Daniel Wallin and Cory Nelson

Lots of testing, suggestions and contributions by Massaroddel and Tianhao Qiu.

Big thanks to Michael Wojciechowski and Peter Koeleman for making the autotools scripts.

Thanks to Reimond Retz for bugfixes, suggestions and testing

-

Thanks to University of Umeå for providing development and test hardware.

+

Thanks to University of Umeå for providing development and test hardware.

Project is hosted by sourceforge.

-

sf_logo

+

sf_logo

diff --git a/docs/manual.rst b/docs/manual.rst index 9df22ecad..0c4ee3660 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -2228,6 +2228,8 @@ It contains the following fields:: int seed_rank; int last_scrape; + + bool has_incoming; }; ``progress`` is a value in the range [0, 1], that represents the progress of the @@ -2410,6 +2412,9 @@ 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 +to this torrent.' + peer_info ========= diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 30f59b523..1cae939a3 100755 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -909,6 +909,10 @@ namespace libtorrent // has been initialized with files_checked(). bool m_connections_initialized:1; + // is set to true every time there is an incoming + // connection to this torrent + bool m_has_incoming:1; + #ifndef NDEBUG bool m_files_checked:1; #endif diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index cd499a033..3d511d931 100755 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -120,6 +120,7 @@ namespace libtorrent , seeding_time(0) , seed_rank(0) , last_scrape(0) + , has_incoming(false) {} enum state_t @@ -266,6 +267,10 @@ namespace libtorrent // number of seconds since last scrape, or -1 if // there hasn't been a scrape int last_scrape; + + // true if there are incoming connections to this + // torrent + bool has_incoming; }; struct TORRENT_EXPORT block_info diff --git a/src/torrent.cpp b/src/torrent.cpp index d1b747300..786655f0d 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -201,6 +201,7 @@ namespace libtorrent , m_sequential_download(false) , m_got_tracker_response(false) , m_connections_initialized(true) + , m_has_incoming(false) { if (resume_data) m_resume_data = *resume_data; #ifndef NDEBUG @@ -275,6 +276,7 @@ namespace libtorrent , m_sequential_download(false) , m_got_tracker_response(false) , m_connections_initialized(false) + , m_has_incoming(false) { if (resume_data) m_resume_data = *resume_data; #ifndef NDEBUG @@ -2714,6 +2716,8 @@ namespace libtorrent TORRENT_ASSERT(p != 0); TORRENT_ASSERT(!p->is_local()); + m_has_incoming = true; + if ((m_state == torrent_status::queued_for_checking || m_state == torrent_status::checking_files) && valid_metadata()) @@ -3912,6 +3916,7 @@ namespace libtorrent torrent_status st; + st.has_incoming = m_has_incoming; st.error = m_error; if (m_last_scrape == min_time())