forked from premiere/premiere-libtorrent
add build option to disable super seeding feature
This commit is contained in:
parent
67b99b28cb
commit
b570f53ebf
3
Jamfile
3
Jamfile
|
@ -441,6 +441,9 @@ feature.compose <predictive-pieces>off : <define>TORRENT_DISABLE_PREDICTIVE_PIEC
|
||||||
feature streaming : on off : composite propagated ;
|
feature streaming : on off : composite propagated ;
|
||||||
feature.compose <streaming>off : <define>TORRENT_DISABLE_STREAMING ;
|
feature.compose <streaming>off : <define>TORRENT_DISABLE_STREAMING ;
|
||||||
|
|
||||||
|
feature super-seeding : on off : composite propagated ;
|
||||||
|
feature.compose <super-seeding>off : <define>TORRENT_DISABLE_SUPERSEEDING ;
|
||||||
|
|
||||||
feature i2p : on off : composite propagated ;
|
feature i2p : on off : composite propagated ;
|
||||||
feature.compose <i2p>on : <define>TORRENT_USE_I2P=1 ;
|
feature.compose <i2p>on : <define>TORRENT_USE_I2P=1 ;
|
||||||
feature.compose <i2p>off : <define>TORRENT_USE_I2P=0 ;
|
feature.compose <i2p>off : <define>TORRENT_USE_I2P=0 ;
|
||||||
|
|
|
@ -384,6 +384,9 @@ Build features:
|
||||||
| | ``set_piece_deadline()``. |
|
| | ``set_piece_deadline()``. |
|
||||||
| | * ``off`` - disable streaming functionality. |
|
| | * ``off`` - disable streaming functionality. |
|
||||||
+--------------------------+----------------------------------------------------+
|
+--------------------------+----------------------------------------------------+
|
||||||
|
| ``super-seeding`` | * ``on`` - enable super seeding feature |
|
||||||
|
| | * ``off`` - disable super seeding feature |
|
||||||
|
+--------------------------+----------------------------------------------------+
|
||||||
| ``predictive-pieces`` | * ``on`` - enable predictive piece announce |
|
| ``predictive-pieces`` | * ``on`` - enable predictive piece announce |
|
||||||
| | feature. i.e. |
|
| | feature. i.e. |
|
||||||
| | settings_pack::predictive_piece_announce |
|
| | settings_pack::predictive_piece_announce |
|
||||||
|
@ -537,6 +540,10 @@ defines you can use to control the build.
|
||||||
| | peer_log_alert. With this build flag, you |
|
| | peer_log_alert. With this build flag, you |
|
||||||
| | cannot enable those alerts. |
|
| | cannot enable those alerts. |
|
||||||
+----------------------------------------+-------------------------------------------------+
|
+----------------------------------------+-------------------------------------------------+
|
||||||
|
| ``TORRENT_DISABLE_SUPERSEEDING`` | This macro will disable support for super |
|
||||||
|
| | seeding. The settings will exist, but will not |
|
||||||
|
| | have an effect, when this macro is defined. |
|
||||||
|
+----------------------------------------+-------------------------------------------------+
|
||||||
| ``TORRENT_DISABLE_MUTABLE_TORRENTS`` | Disables mutable torrent support (`BEP 38`_) |
|
| ``TORRENT_DISABLE_MUTABLE_TORRENTS`` | Disables mutable torrent support (`BEP 38`_) |
|
||||||
+----------------------------------------+-------------------------------------------------+
|
+----------------------------------------+-------------------------------------------------+
|
||||||
| ``TORRENT_DISABLE_STREAMING`` | Disables set_piece_deadline() and associated |
|
| ``TORRENT_DISABLE_STREAMING`` | Disables set_piece_deadline() and associated |
|
||||||
|
|
|
@ -367,6 +367,7 @@ namespace aux {
|
||||||
// it will let the peer know that we have the given piece
|
// it will let the peer know that we have the given piece
|
||||||
void announce_piece(piece_index_t index);
|
void announce_piece(piece_index_t index);
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
// this will tell the peer to announce the given piece
|
// this will tell the peer to announce the given piece
|
||||||
// and only allow it to request that piece
|
// and only allow it to request that piece
|
||||||
void superseed_piece(piece_index_t replace_piece, piece_index_t new_piece);
|
void superseed_piece(piece_index_t replace_piece, piece_index_t new_piece);
|
||||||
|
@ -375,6 +376,7 @@ namespace aux {
|
||||||
return m_superseed_piece[0] == index
|
return m_superseed_piece[0] == index
|
||||||
|| m_superseed_piece[1] == index;
|
|| m_superseed_piece[1] == index;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// tells if this connection has data it want to send
|
// tells if this connection has data it want to send
|
||||||
// and has enough upload bandwidth quota left to send it.
|
// and has enough upload bandwidth quota left to send it.
|
||||||
|
@ -1016,12 +1018,14 @@ namespace aux {
|
||||||
// by sending choke, unchoke.
|
// by sending choke, unchoke.
|
||||||
int m_num_invalid_requests = 0;
|
int m_num_invalid_requests = 0;
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
// if [0] is -1, super-seeding is not active. If it is >= 0
|
// if [0] is -1, super-seeding is not active. If it is >= 0
|
||||||
// this is the piece that is available to this peer. Only
|
// this is the piece that is available to this peer. Only
|
||||||
// these two pieces can be downloaded from us by this peer.
|
// these two pieces can be downloaded from us by this peer.
|
||||||
// This will remain the current piece for this peer until
|
// This will remain the current piece for this peer until
|
||||||
// another peer sends us a have message for this piece
|
// another peer sends us a have message for this piece
|
||||||
std::array<piece_index_t, 2> m_superseed_piece = {{piece_index_t(-1), piece_index_t(-1)}};
|
std::array<piece_index_t, 2> m_superseed_piece = {{piece_index_t(-1), piece_index_t(-1)}};
|
||||||
|
#endif
|
||||||
|
|
||||||
// the number of bytes send to the disk-io
|
// the number of bytes send to the disk-io
|
||||||
// thread that hasn't yet been completely written.
|
// thread that hasn't yet been completely written.
|
||||||
|
|
|
@ -779,6 +779,7 @@ namespace libtorrent {
|
||||||
|
|
||||||
void recalc_share_mode();
|
void recalc_share_mode();
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
bool super_seeding() const
|
bool super_seeding() const
|
||||||
{
|
{
|
||||||
// we're not super seeding if we're not a seed
|
// we're not super seeding if we're not a seed
|
||||||
|
@ -787,6 +788,7 @@ namespace libtorrent {
|
||||||
|
|
||||||
void set_super_seeding(bool on);
|
void set_super_seeding(bool on);
|
||||||
piece_index_t get_piece_to_super_seed(typed_bitfield<piece_index_t> const&);
|
piece_index_t get_piece_to_super_seed(typed_bitfield<piece_index_t> const&);
|
||||||
|
#endif
|
||||||
|
|
||||||
// returns true if we have downloaded the given piece
|
// returns true if we have downloaded the given piece
|
||||||
bool have_piece(piece_index_t index) const
|
bool have_piece(piece_index_t index) const
|
||||||
|
@ -1573,9 +1575,11 @@ namespace libtorrent {
|
||||||
// haven't
|
// haven't
|
||||||
bool m_seed_mode:1;
|
bool m_seed_mode:1;
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
// if this is true, we're currently super seeding this
|
// if this is true, we're currently super seeding this
|
||||||
// torrent.
|
// torrent.
|
||||||
bool m_super_seeding:1;
|
bool m_super_seeding:1;
|
||||||
|
#endif
|
||||||
|
|
||||||
// if this is set, whenever transitioning into a downloading/seeding state
|
// if this is set, whenever transitioning into a downloading/seeding state
|
||||||
// from a non-downloading/seeding state, the torrent is paused.
|
// from a non-downloading/seeding state, the torrent is paused.
|
||||||
|
|
|
@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using namespace lt;
|
using namespace lt;
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
TORRENT_TEST(super_seeding)
|
TORRENT_TEST(super_seeding)
|
||||||
{
|
{
|
||||||
setup_swarm(5, swarm_test::upload
|
setup_swarm(5, swarm_test::upload
|
||||||
|
@ -70,4 +71,4 @@ TORRENT_TEST(strict_super_seeding)
|
||||||
, [](int, lt::session&) -> bool
|
, [](int, lt::session&) -> bool
|
||||||
{ return true; });
|
{ return true; });
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -300,7 +300,11 @@ namespace {
|
||||||
std::shared_ptr<torrent> t = associated_torrent().lock();
|
std::shared_ptr<torrent> t = associated_torrent().lock();
|
||||||
if (!t->share_mode())
|
if (!t->share_mode())
|
||||||
{
|
{
|
||||||
bool const upload_only_enabled = t->is_upload_only() && !t->super_seeding();
|
bool const upload_only_enabled = t->is_upload_only()
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
|
&& !t->super_seeding()
|
||||||
|
#endif
|
||||||
|
;
|
||||||
send_upload_only(upload_only_enabled);
|
send_upload_only(upload_only_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1968,6 +1972,7 @@ namespace {
|
||||||
TORRENT_ASSERT(m_sent_handshake);
|
TORRENT_ASSERT(m_sent_handshake);
|
||||||
TORRENT_ASSERT(t->valid_metadata());
|
TORRENT_ASSERT(t->valid_metadata());
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
if (t->super_seeding())
|
if (t->super_seeding())
|
||||||
{
|
{
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
|
@ -1986,7 +1991,9 @@ namespace {
|
||||||
if (piece >= piece_index_t(0)) superseed_piece(piece_index_t(-1), piece);
|
if (piece >= piece_index_t(0)) superseed_piece(piece_index_t(-1), piece);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (m_supports_fast && t->is_seed())
|
else
|
||||||
|
#endif
|
||||||
|
if (m_supports_fast && t->is_seed())
|
||||||
{
|
{
|
||||||
write_have_all();
|
write_have_all();
|
||||||
return;
|
return;
|
||||||
|
@ -2138,7 +2145,10 @@ namespace {
|
||||||
if (t->is_upload_only()
|
if (t->is_upload_only()
|
||||||
&& !t->share_mode()
|
&& !t->share_mode()
|
||||||
&& t->valid_metadata()
|
&& t->valid_metadata()
|
||||||
&& !t->super_seeding())
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
|
&& !t->super_seeding()
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
handshake["upload_only"] = 1;
|
handshake["upload_only"] = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -632,6 +632,7 @@ namespace libtorrent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
if (t->super_seeding())
|
if (t->super_seeding())
|
||||||
{
|
{
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
|
@ -639,6 +640,7 @@ namespace libtorrent {
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (upload_only())
|
if (upload_only())
|
||||||
{
|
{
|
||||||
|
@ -1941,6 +1943,7 @@ namespace libtorrent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
if (t->super_seeding() && !m_settings.get_bool(settings_pack::strict_super_seeding))
|
if (t->super_seeding() && !m_settings.get_bool(settings_pack::strict_super_seeding))
|
||||||
{
|
{
|
||||||
// if we're super-seeding and the peer just told
|
// if we're super-seeding and the peer just told
|
||||||
|
@ -1954,6 +1957,7 @@ namespace libtorrent {
|
||||||
superseed_piece(index, t->get_piece_to_super_seed(m_have_piece));
|
superseed_piece(index, t->get_piece_to_super_seed(m_have_piece));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_have_piece[index])
|
if (m_have_piece[index])
|
||||||
{
|
{
|
||||||
|
@ -2016,6 +2020,7 @@ namespace libtorrent {
|
||||||
disconnect_if_redundant();
|
disconnect_if_redundant();
|
||||||
if (is_disconnecting()) return;
|
if (is_disconnecting()) return;
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
// if we're super seeding, this might mean that somebody
|
// if we're super seeding, this might mean that somebody
|
||||||
// forwarded this piece. In which case we need to give
|
// forwarded this piece. In which case we need to give
|
||||||
// a new piece to that peer
|
// a new piece to that peer
|
||||||
|
@ -2030,6 +2035,7 @@ namespace libtorrent {
|
||||||
p->superseed_piece(index, t->get_piece_to_super_seed(p->get_bitfield()));
|
p->superseed_piece(index, t->get_piece_to_super_seed(p->get_bitfield()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
|
@ -2315,6 +2321,7 @@ namespace libtorrent {
|
||||||
, "piece: %d s: %x l: %x", static_cast<int>(r.piece), r.start, r.length);
|
, "piece: %d s: %x l: %x", static_cast<int>(r.piece), r.start, r.length);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
if (t->super_seeding()
|
if (t->super_seeding()
|
||||||
&& !super_seeded_piece(r.piece))
|
&& !super_seeded_piece(r.piece))
|
||||||
{
|
{
|
||||||
|
@ -2348,6 +2355,7 @@ namespace libtorrent {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif // TORRENT_DISABLE_SUPERSEEDING
|
||||||
|
|
||||||
// if we haven't received a bitfield, it was
|
// if we haven't received a bitfield, it was
|
||||||
// probably omitted, which is the same as 'have_none'
|
// probably omitted, which is the same as 'have_none'
|
||||||
|
@ -4606,6 +4614,7 @@ namespace libtorrent {
|
||||||
p.local_endpoint = get_socket()->local_endpoint(ec);
|
p.local_endpoint = get_socket()->local_endpoint(ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
// TODO: 3 new_piece should be an optional<piece_index_t>. piece index -1
|
// TODO: 3 new_piece should be an optional<piece_index_t>. piece index -1
|
||||||
// should not be allowed
|
// should not be allowed
|
||||||
void peer_connection::superseed_piece(piece_index_t const replace_piece
|
void peer_connection::superseed_piece(piece_index_t const replace_piece
|
||||||
|
@ -4654,6 +4663,7 @@ namespace libtorrent {
|
||||||
m_superseed_piece[1] = m_superseed_piece[0];
|
m_superseed_piece[1] = m_superseed_piece[0];
|
||||||
m_superseed_piece[0] = new_piece;
|
m_superseed_piece[0] = new_piece;
|
||||||
}
|
}
|
||||||
|
#endif // TORRENT_DISABLE_SUPERSEEDING
|
||||||
|
|
||||||
void peer_connection::max_out_request_queue(int s)
|
void peer_connection::max_out_request_queue(int s)
|
||||||
{
|
{
|
||||||
|
@ -4789,6 +4799,7 @@ namespace libtorrent {
|
||||||
send_block_requests();
|
send_block_requests();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
if (t->super_seeding()
|
if (t->super_seeding()
|
||||||
&& t->ready_for_connections()
|
&& t->ready_for_connections()
|
||||||
&& !m_peer_interested
|
&& !m_peer_interested
|
||||||
|
@ -4798,6 +4809,7 @@ namespace libtorrent {
|
||||||
// become interested in us then
|
// become interested in us then
|
||||||
superseed_piece(piece_index_t(-1), t->get_piece_to_super_seed(m_have_piece));
|
superseed_piece(piece_index_t(-1), t->get_piece_to_super_seed(m_have_piece));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
on_tick();
|
on_tick();
|
||||||
if (is_disconnecting()) return;
|
if (is_disconnecting()) return;
|
||||||
|
|
|
@ -200,7 +200,9 @@ bool is_downloading_state(int const st)
|
||||||
, m_sequential_download(p.flags & torrent_flags::sequential_download)
|
, m_sequential_download(p.flags & torrent_flags::sequential_download)
|
||||||
, m_auto_sequential(false)
|
, m_auto_sequential(false)
|
||||||
, m_seed_mode(false)
|
, m_seed_mode(false)
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
, m_super_seeding(p.flags & torrent_flags::super_seeding)
|
, m_super_seeding(p.flags & torrent_flags::super_seeding)
|
||||||
|
#endif
|
||||||
, m_stop_when_ready(p.flags & torrent_flags::stop_when_ready)
|
, m_stop_when_ready(p.flags & torrent_flags::stop_when_ready)
|
||||||
, m_need_save_resume_data(p.flags & torrent_flags::need_save_resume)
|
, m_need_save_resume_data(p.flags & torrent_flags::need_save_resume)
|
||||||
, m_enable_dht(!bool(p.flags & torrent_flags::disable_dht))
|
, m_enable_dht(!bool(p.flags & torrent_flags::disable_dht))
|
||||||
|
@ -692,7 +694,11 @@ bool is_downloading_state(int const st)
|
||||||
, m_paused ? "paused " : ""
|
, m_paused ? "paused " : ""
|
||||||
, m_auto_managed ? "auto-managed " : ""
|
, m_auto_managed ? "auto-managed " : ""
|
||||||
, m_state_subscription ? "update-subscribe " : ""
|
, m_state_subscription ? "update-subscribe " : ""
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
, m_super_seeding ? "super-seeding " : ""
|
, m_super_seeding ? "super-seeding " : ""
|
||||||
|
#else
|
||||||
|
, ""
|
||||||
|
#endif
|
||||||
, m_sequential_download ? "sequential-download " : ""
|
, m_sequential_download ? "sequential-download " : ""
|
||||||
, (m_add_torrent_params && m_add_torrent_params->flags & torrent_flags::override_trackers)
|
, (m_add_torrent_params && m_add_torrent_params->flags & torrent_flags::override_trackers)
|
||||||
? "override-trackers " : ""
|
? "override-trackers " : ""
|
||||||
|
@ -931,7 +937,9 @@ bool is_downloading_state(int const st)
|
||||||
{
|
{
|
||||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||||
if (share_mode()) return;
|
if (share_mode()) return;
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
if (super_seeding()) return;
|
if (super_seeding()) return;
|
||||||
|
#endif
|
||||||
|
|
||||||
// if we send upload-only, the other end is very likely to disconnect
|
// if we send upload-only, the other end is very likely to disconnect
|
||||||
// us, at least if it's a seed. If we don't want to close redundant
|
// us, at least if it's a seed. If we don't want to close redundant
|
||||||
|
@ -943,7 +951,11 @@ bool is_downloading_state(int const st)
|
||||||
// only, since they might disconnect immediately when
|
// only, since they might disconnect immediately when
|
||||||
// they have downloaded a single piece, although we'll
|
// they have downloaded a single piece, although we'll
|
||||||
// make another piece available
|
// make another piece available
|
||||||
bool const upload_only_enabled = is_upload_only() && !super_seeding();
|
bool const upload_only_enabled = is_upload_only()
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
|
&& !super_seeding()
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
for (auto p : m_connections)
|
for (auto p : m_connections)
|
||||||
{
|
{
|
||||||
|
@ -970,8 +982,10 @@ bool is_downloading_state(int const st)
|
||||||
ret |= torrent_flags::paused;
|
ret |= torrent_flags::paused;
|
||||||
if (m_auto_managed)
|
if (m_auto_managed)
|
||||||
ret |= torrent_flags::auto_managed;
|
ret |= torrent_flags::auto_managed;
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
if (m_super_seeding)
|
if (m_super_seeding)
|
||||||
ret |= torrent_flags::super_seeding;
|
ret |= torrent_flags::super_seeding;
|
||||||
|
#endif
|
||||||
if (m_sequential_download)
|
if (m_sequential_download)
|
||||||
ret |= torrent_flags::sequential_download;
|
ret |= torrent_flags::sequential_download;
|
||||||
if (m_stop_when_ready)
|
if (m_stop_when_ready)
|
||||||
|
@ -1008,8 +1022,10 @@ bool is_downloading_state(int const st)
|
||||||
}
|
}
|
||||||
if (mask & torrent_flags::auto_managed)
|
if (mask & torrent_flags::auto_managed)
|
||||||
auto_managed(bool(flags & torrent_flags::auto_managed));
|
auto_managed(bool(flags & torrent_flags::auto_managed));
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
if (mask & torrent_flags::super_seeding)
|
if (mask & torrent_flags::super_seeding)
|
||||||
set_super_seeding(bool(flags & torrent_flags::super_seeding));
|
set_super_seeding(bool(flags & torrent_flags::super_seeding));
|
||||||
|
#endif
|
||||||
if (mask & torrent_flags::sequential_download)
|
if (mask & torrent_flags::sequential_download)
|
||||||
set_sequential_download(bool(flags & torrent_flags::sequential_download));
|
set_sequential_download(bool(flags & torrent_flags::sequential_download));
|
||||||
if (mask & torrent_flags::stop_when_ready)
|
if (mask & torrent_flags::stop_when_ready)
|
||||||
|
@ -4484,6 +4500,7 @@ bool is_downloading_state(int const st)
|
||||||
m_num_connecting_seeds = 0;
|
m_num_connecting_seeds = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
void torrent::set_super_seeding(bool on)
|
void torrent::set_super_seeding(bool on)
|
||||||
{
|
{
|
||||||
if (on == m_super_seeding) return;
|
if (on == m_super_seeding) return;
|
||||||
|
@ -4545,6 +4562,7 @@ bool is_downloading_state(int const st)
|
||||||
if (avail_vec.empty()) return piece_index_t(-1);
|
if (avail_vec.empty()) return piece_index_t(-1);
|
||||||
return avail_vec[random(std::uint32_t(avail_vec.size() - 1))];
|
return avail_vec[random(std::uint32_t(avail_vec.size() - 1))];
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void torrent::on_files_deleted(storage_error const& error) try
|
void torrent::on_files_deleted(storage_error const& error) try
|
||||||
{
|
{
|
||||||
|
@ -6246,7 +6264,9 @@ bool is_downloading_state(int const st)
|
||||||
ret.flags = torrent_flags_t{};
|
ret.flags = torrent_flags_t{};
|
||||||
if (m_sequential_download) ret.flags |= torrent_flags::sequential_download;
|
if (m_sequential_download) ret.flags |= torrent_flags::sequential_download;
|
||||||
if (m_seed_mode ) ret.flags |= torrent_flags::seed_mode;
|
if (m_seed_mode ) ret.flags |= torrent_flags::seed_mode;
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
if (m_super_seeding ) ret.flags |= torrent_flags::super_seeding;
|
if (m_super_seeding ) ret.flags |= torrent_flags::super_seeding;
|
||||||
|
#endif
|
||||||
if (is_torrent_paused()) ret.flags |= torrent_flags::paused;
|
if (is_torrent_paused()) ret.flags |= torrent_flags::paused;
|
||||||
if (m_auto_managed ) ret.flags |= torrent_flags::auto_managed;
|
if (m_auto_managed ) ret.flags |= torrent_flags::auto_managed;
|
||||||
if (m_stop_when_ready) ret.flags |= torrent_flags::stop_when_ready;
|
if (m_stop_when_ready) ret.flags |= torrent_flags::stop_when_ready;
|
||||||
|
@ -7590,6 +7610,7 @@ bool is_downloading_state(int const st)
|
||||||
|
|
||||||
if (!is_seed())
|
if (!is_seed())
|
||||||
{
|
{
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
// turn off super seeding if we're not a seed
|
// turn off super seeding if we're not a seed
|
||||||
if (m_super_seeding)
|
if (m_super_seeding)
|
||||||
{
|
{
|
||||||
|
@ -7597,6 +7618,7 @@ bool is_downloading_state(int const st)
|
||||||
set_need_save_resume();
|
set_need_save_resume();
|
||||||
state_updated();
|
state_updated();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_state != torrent_status::finished && is_finished())
|
if (m_state != torrent_status::finished && is_finished())
|
||||||
finished();
|
finished();
|
||||||
|
|
|
@ -148,6 +148,7 @@ TORRENT_TEST(flag_auto_managed)
|
||||||
test_unset_after_add(torrent_flags::auto_managed);
|
test_unset_after_add(torrent_flags::auto_managed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_SUPERSEEDING
|
||||||
TORRENT_TEST(flag_super_seeding)
|
TORRENT_TEST(flag_super_seeding)
|
||||||
{
|
{
|
||||||
// super-seeding
|
// super-seeding
|
||||||
|
@ -155,6 +156,7 @@ TORRENT_TEST(flag_super_seeding)
|
||||||
test_set_after_add(torrent_flags::super_seeding);
|
test_set_after_add(torrent_flags::super_seeding);
|
||||||
test_unset_after_add(torrent_flags::super_seeding);
|
test_unset_after_add(torrent_flags::super_seeding);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TORRENT_TEST(flag_sequential_download)
|
TORRENT_TEST(flag_sequential_download)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue