merged RC_1_1 into master

This commit is contained in:
arvidn 2017-12-02 11:39:23 +01:00
commit 5ce798197c
10 changed files with 35 additions and 39 deletions

View File

@ -81,6 +81,7 @@
* resume data no longer has timestamps of files * resume data no longer has timestamps of files
* require C++11 to build libtorrent * require C++11 to build libtorrent
* fix issue with receiving interested before metadata
* fix IPv6 tracker announce issue * fix IPv6 tracker announce issue
* restore path sanitization behavior of ":" * restore path sanitization behavior of ":"
* fix listen socket issue when disabling "force_proxy" mode * fix listen socket issue when disabling "force_proxy" mode

View File

@ -18,13 +18,9 @@ print('starting', s.name)
while (not s.is_seeding): while (not s.is_seeding):
s = h.status() s = h.status()
state_str = [
'queued', 'checking', 'downloading metadata',
'downloading', 'finished', 'seeding', 'allocating',
'checking fastresume']
print('\r%.2f%% complete (down: %.1f kB/s up: %.1f kB/s peers: %d) %s' % ( print('\r%.2f%% complete (down: %.1f kB/s up: %.1f kB/s peers: %d) %s' % (
s.progress * 100, s.download_rate / 1000, s.upload_rate / 1000, s.progress * 100, s.download_rate / 1000, s.upload_rate / 1000,
s.num_peers, state_str[s.state]), end=' ') s.num_peers, s.state), end=' ')
alerts = ses.pop_alerts() alerts = ses.pop_alerts()
for a in alerts: for a in alerts:

View File

@ -775,6 +775,12 @@ The default peer class IDs are defined as enums in the ``session`` class:
local_peer_class_id local_peer_class_id
}; };
The default peer classes are automatically created on session startup, and
configured to apply to each respective type of connection. There's nothing
preventing a client from reconfiguring the peer class ip- and type filters
to disable or customize which peers they apply to. See set_peer_class_filter()
and set_peer_class_type_filter().
A peer class can be considered a more general form of *lables* that some A peer class can be considered a more general form of *lables* that some
clients have. Peer classes however are not just applied to torrents, but clients have. Peer classes however are not just applied to torrents, but
ultimately the peers. ultimately the peers.
@ -784,9 +790,9 @@ object), and deleted with the delete_peer_class() call.
Peer classes are configured with the set_peer_class() get_peer_class() calls. Peer classes are configured with the set_peer_class() get_peer_class() calls.
Custom peer classes can be assigned to torrents, with the ??? call, in which Custom peer classes can be assigned based on the peer's IP address or the type
case all its peers will belong to the class. They can also be assigned based on of transport protocol used. See set_peer_class_filter() and
the peer's IP address. See set_peer_class_filter() for more information. set_peer_class_type_filter() for more information.
peer class examples peer class examples
------------------- -------------------

View File

@ -114,31 +114,10 @@ In order to interpret the statistics array, in C++ it is required to call ``sess
For an example python program, see ``client.py`` in the ``bindings/python`` For an example python program, see ``client.py`` in the ``bindings/python``
directory. directory.
A very simple example usage of the module would be something like this:: A very simple example usage of the module would be something like this:
import libtorrent as lt .. include:: ../bindings/python/simple_client.py
import time :code: python
:tab-width: 2
ses = lt.session() :start-after: from __future__ import print_function
ses.listen_on(6881, 6891)
e = lt.bdecode(open("test.torrent", 'rb').read())
info = lt.torrent_info(e)
params = { 'save_path': '.', \
'storage_mode': lt.storage_mode_t.storage_mode_sparse, \
'ti': info }
h = ses.add_torrent(params)
s = h.status()
while (not s.is_seeding):
s = h.status()
state_str = ['queued', 'checking', 'downloading metadata', \
'downloading', 'finished', 'seeding', 'allocating']
print '%.2f%% complete (down: %.1f kb/s up: %.1f kB/s peers: %d) %s' % \
(s.progress * 100, s.download_rate / 1000, s.upload_rate / 1000, \
s.num_peers, state_str[s.state])
time.sleep(1)

View File

@ -71,7 +71,7 @@ TORRENT_EXPORT void assert_fail(const char* expr, int line
#if TORRENT_USE_ASSERTS #if TORRENT_USE_ASSERTS
#ifdef TORRENT_PRODUCTION_ASSERTS #ifdef TORRENT_PRODUCTION_ASSERTS
extern char const* libtorrent_assert_log; extern TORRENT_EXPORT char const* libtorrent_assert_log;
#endif #endif
#if TORRENT_USE_IOSTREAM #if TORRENT_USE_IOSTREAM

View File

@ -42,8 +42,12 @@ namespace sim { namespace asio {
}} }}
#else #else
namespace boost { namespace asio { namespace boost { namespace asio {
#if BOOST_VERSION < 106600
class io_service; class io_service;
#else
class io_context;
typedef io_context io_service;
#endif
}} }}
#endif #endif

View File

@ -53,7 +53,9 @@ namespace libtorrent {
using peer_class_t = aux::strong_typedef<std::uint32_t, aux::peer_class_tag>; using peer_class_t = aux::strong_typedef<std::uint32_t, aux::peer_class_tag>;
struct peer_class_info // holds settings for a peer class. Used in set_peer_class() and
// get_peer_class() calls.
struct TORRENT_EXPORT peer_class_info
{ {
// ``ignore_unchoke_slots`` determines whether peers should always // ``ignore_unchoke_slots`` determines whether peers should always
// unchoke a peer, regardless of the choking algorithm, or if it should // unchoke a peer, regardless of the choking algorithm, or if it should

View File

@ -41,7 +41,7 @@ namespace libtorrent {
// ``peer_class_type_filter`` is a simple container for rules for adding and subtracting // ``peer_class_type_filter`` is a simple container for rules for adding and subtracting
// peer-classes from peers. It is applied *after* the peer class filter is applied (which // peer-classes from peers. It is applied *after* the peer class filter is applied (which
// is based on the peer's IP address). // is based on the peer's IP address).
struct peer_class_type_filter struct TORRENT_EXPORT peer_class_type_filter
{ {
peer_class_type_filter() peer_class_type_filter()
{ {

View File

@ -700,7 +700,7 @@ namespace libtorrent {
// return value of ``get_peer_class()`` is undefined. // return value of ``get_peer_class()`` is undefined.
// //
// ``set_peer_class()`` sets all the information in the // ``set_peer_class()`` sets all the information in the
// ``peer_class_info`` object in the specified peer class. There is no // peer_class_info object in the specified peer class. There is no
// option to only update a single property. // option to only update a single property.
// //
// A peer or torrent belonging to more than one class, the highest // A peer or torrent belonging to more than one class, the highest

View File

@ -542,6 +542,14 @@ namespace libtorrent {
std::shared_ptr<torrent> t = m_torrent.lock(); std::shared_ptr<torrent> t = m_torrent.lock();
TORRENT_ASSERT(t); TORRENT_ASSERT(t);
if (!t->valid_metadata())
{
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "ALLOWED", "skipping allowed set because we don't have metadata");
#endif
return;
}
if (t->super_seeding()) if (t->super_seeding())
{ {
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING