deprecate strict super seeding mode

This commit is contained in:
arvidn 2020-03-20 00:10:47 +01:00 committed by Arvid Norberg
parent b570f53ebf
commit be10ccd881
8 changed files with 33 additions and 5 deletions

View File

@ -1,3 +1,4 @@
* deprecate strict super seeding mode
* make UPnP port-mapping lease duration configurable
* deprecate the bittyrant choking algorithm
* add build option to disable streaming

View File

@ -425,10 +425,14 @@ namespace aux {
// preference of one protocol over another.
prefer_udp_trackers,
#if TORRENT_ABI_VERSION == 1
// ``strict_super_seeding`` when this is set to true, a piece has to
// have been forwarded to a third peer before another one is handed
// out. This is the traditional definition of super seeding.
strict_super_seeding,
strict_super_seeding TORRENT_DEPRECATED_ENUM,
#else
deprecated_strict_super_seeding,
#endif
#if TORRENT_ABI_VERSION == 1
// if this is set to true, the memory allocated for the disk cache

View File

@ -54,6 +54,7 @@ TORRENT_TEST(super_seeding)
{ return true; });
}
#if TORRENT_ABI_VERSION == 1
TORRENT_TEST(strict_super_seeding)
{
setup_swarm(5, swarm_test::upload
@ -72,3 +73,6 @@ TORRENT_TEST(strict_super_seeding)
{ return true; });
}
#endif
#else
TORRENT_TEST(summy) {}
#endif

View File

@ -1944,7 +1944,11 @@ namespace libtorrent {
}
#ifndef TORRENT_DISABLE_SUPERSEEDING
if (t->super_seeding() && !m_settings.get_bool(settings_pack::strict_super_seeding))
if (t->super_seeding()
#if TORRENT_ABI_VERSION == 1
&& !m_settings.get_bool(settings_pack::strict_super_seeding)
#endif
)
{
// if we're super-seeding and the peer just told
// us that it completed the piece we're super-seeding
@ -2021,6 +2025,7 @@ namespace libtorrent {
if (is_disconnecting()) return;
#ifndef TORRENT_DISABLE_SUPERSEEDING
#if TORRENT_ABI_VERSION == 1
// if we're super seeding, this might mean that somebody
// forwarded this piece. In which case we need to give
// a new piece to that peer
@ -2035,7 +2040,8 @@ namespace libtorrent {
p->superseed_piece(index, t->get_piece_to_super_seed(p->get_bitfield()));
}
}
#endif
#endif // TORRENT_ABI_VERSION
#endif // TORRENT_DISABLE_SUPERSEEDING
}
// -----------------------------

View File

@ -159,7 +159,7 @@ constexpr int CLOSE_FILE_INTERVAL = 0;
SET(announce_to_all_trackers, false, nullptr),
SET(announce_to_all_tiers, false, nullptr),
SET(prefer_udp_trackers, true, nullptr),
SET(strict_super_seeding, false, nullptr),
DEPRECATED_SET(strict_super_seeding, false, nullptr),
DEPRECATED_SET(lock_disk_cache, false, nullptr),
SET(disable_hash_checks, false, nullptr),
SET(allow_i2p_mixed, false, nullptr),

View File

@ -10772,7 +10772,9 @@ bool is_downloading_state(int const st)
st->is_seeding = is_seed();
st->is_finished = is_finished();
#if TORRENT_ABI_VERSION == 1
#ifndef TORRENT_DISABLE_SUPERSEEDING
st->super_seeding = m_super_seeding;
#endif
#endif
st->has_metadata = valid_metadata();
bytes_done(*st, flags);

View File

@ -598,7 +598,13 @@ namespace libtorrent {
{ return sync_call_ret<bool>(false, &torrent::valid_metadata); }
bool torrent_handle::super_seeding() const
{ return sync_call_ret<bool>(false, &torrent::super_seeding); }
{
#ifndef TORRENT_DISABLE_SUPERSEEDING
return sync_call_ret<bool>(false, &torrent::super_seeding);
#else
return false;
#endif
}
// ============ end deprecation ===============
#endif
@ -776,7 +782,10 @@ namespace libtorrent {
#if TORRENT_ABI_VERSION == 1
void torrent_handle::super_seeding(bool on) const
{
TORRENT_UNUSED(on);
#ifndef TORRENT_DISABLE_SUPERSEEDING
async_call(&torrent::set_super_seeding, on);
#endif
}
void torrent_handle::get_full_peer_list(std::vector<peer_list_entry>& v) const

View File

@ -78,8 +78,10 @@ void test_swarm(test_flags_t const flags)
settings_pack pack = settings();
pack.set_bool(settings_pack::allow_multiple_connections_per_ip, true);
#if TORRENT_ABI_VERSION == 1
if (flags & test_flags::strict_super_seeding)
pack.set_bool(settings_pack::strict_super_seeding, true);
#endif
if (flags & test_flags::suggest)
pack.set_int(settings_pack::suggest_mode, settings_pack::suggest_read_cache);