add test for suggests- and seed mode combined
This commit is contained in:
parent
fe25b50b1a
commit
299a545648
|
@ -58,6 +58,25 @@ TORRENT_TEST(seed_mode)
|
||||||
{ return true; });
|
{ return true; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TORRENT_TEST(seed_mode_suggest)
|
||||||
|
{
|
||||||
|
setup_swarm(2, swarm_test::upload
|
||||||
|
// add session
|
||||||
|
, [](lt::settings_pack& pack) {
|
||||||
|
pack.set_int(settings_pack::suggest_mode, settings_pack::suggest_read_cache);
|
||||||
|
pack.set_int(settings_pack::cache_size, 2);
|
||||||
|
}
|
||||||
|
// add torrent
|
||||||
|
, [](lt::add_torrent_params& params) {
|
||||||
|
params.flags |= add_torrent_params::flag_seed_mode;
|
||||||
|
}
|
||||||
|
// on alert
|
||||||
|
, [](lt::alert const* a, lt::session& ses) {}
|
||||||
|
// terminate
|
||||||
|
, [](int ticks, lt::session& ses) -> bool
|
||||||
|
{ return true; });
|
||||||
|
}
|
||||||
|
|
||||||
TORRENT_TEST(plain)
|
TORRENT_TEST(plain)
|
||||||
{
|
{
|
||||||
setup_swarm(2, swarm_test::download
|
setup_swarm(2, swarm_test::download
|
||||||
|
@ -129,6 +148,7 @@ TORRENT_TEST(suggest)
|
||||||
// add session
|
// add session
|
||||||
, [](lt::settings_pack& pack) {
|
, [](lt::settings_pack& pack) {
|
||||||
pack.set_int(settings_pack::suggest_mode, settings_pack::suggest_read_cache);
|
pack.set_int(settings_pack::suggest_mode, settings_pack::suggest_read_cache);
|
||||||
|
pack.set_int(settings_pack::cache_size, 2);
|
||||||
}
|
}
|
||||||
// add torrent
|
// add torrent
|
||||||
, [](lt::add_torrent_params& params) {}
|
, [](lt::add_torrent_params& params) {}
|
||||||
|
@ -311,10 +331,11 @@ TORRENT_TEST(stop_start_seed_graceful)
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
TORRENT_TEST(explicit_cache)
|
TORRENT_TEST(explicit_cache)
|
||||||
{
|
{
|
||||||
setup_swarm(2, swarm_test::download
|
setup_swarm(4, swarm_test::download
|
||||||
// add session
|
// add session
|
||||||
, [](lt::settings_pack& pack) {
|
, [](lt::settings_pack& pack) {
|
||||||
pack.set_int(settings_pack::suggest_mode, settings_pack::suggest_read_cache);
|
pack.set_int(settings_pack::suggest_mode, settings_pack::suggest_read_cache);
|
||||||
|
pack.set_int(settings_pack::cache_size, 2);
|
||||||
pack.set_bool(settings_pack::explicit_read_cache, true);
|
pack.set_bool(settings_pack::explicit_read_cache, true);
|
||||||
pack.set_int(settings_pack::explicit_cache_interval, 5);
|
pack.set_int(settings_pack::explicit_cache_interval, 5);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2685,8 +2685,6 @@ namespace libtorrent
|
||||||
#if TORRENT_USE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
pe->piece_log.push_back(piece_log_t(j->action));
|
pe->piece_log.push_back(piece_log_t(j->action));
|
||||||
#endif
|
#endif
|
||||||
TORRENT_PIECE_ASSERT(pe->cache_state <= cached_piece_entry::read_lru1
|
|
||||||
|| pe->cache_state == cached_piece_entry::read_lru2, pe);
|
|
||||||
++pe->piece_refcount;
|
++pe->piece_refcount;
|
||||||
|
|
||||||
int block_size = m_disk_cache.block_size();
|
int block_size = m_disk_cache.block_size();
|
||||||
|
|
|
@ -3832,7 +3832,6 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (m_sent_suggested_pieces.empty())
|
if (m_sent_suggested_pieces.empty())
|
||||||
{
|
{
|
||||||
boost::shared_ptr<torrent> t = m_torrent.lock();
|
boost::shared_ptr<torrent> t = m_torrent.lock();
|
||||||
|
|
Loading…
Reference in New Issue