fixed web seed unit test
This commit is contained in:
parent
d157af5305
commit
0350e86867
|
@ -219,7 +219,7 @@ namespace libtorrent
|
|||
std::string name() const;
|
||||
|
||||
stat statistics() const { return m_stat; }
|
||||
void add_stats(stat const& s) { m_stat += s; }
|
||||
void add_stats(stat const& s);
|
||||
size_type bytes_left() const;
|
||||
int block_bytes_wanted(piece_block const& p) const;
|
||||
void bytes_done(torrent_status& st) const;
|
||||
|
|
|
@ -5339,6 +5339,7 @@ namespace libtorrent
|
|||
if (is_paused())
|
||||
{
|
||||
// let the stats fade out to 0
|
||||
accumulator += m_stat;
|
||||
m_stat.second_tick(tick_interval_ms);
|
||||
return;
|
||||
}
|
||||
|
@ -5461,6 +5462,13 @@ namespace libtorrent
|
|||
m_stat.second_tick(tick_interval_ms);
|
||||
}
|
||||
|
||||
void torrent::add_stats(stat const& s)
|
||||
{
|
||||
// these stats are propagated to the session
|
||||
// stats the next time second_tick is called
|
||||
m_stat += s;
|
||||
}
|
||||
|
||||
void torrent::request_time_critical_pieces()
|
||||
{
|
||||
// build a list of peers and sort it by download_queue_time
|
||||
|
|
|
@ -53,12 +53,10 @@ void test_transfer(boost::intrusive_ptr<torrent_info> torrent_file, int proxy)
|
|||
|
||||
session ses(fingerprint(" ", 0,0,0,0), 0);
|
||||
session_settings settings;
|
||||
settings.ignore_limits_on_local_network = false;
|
||||
settings.max_queued_disk_bytes = 256 * 1024;
|
||||
ses.set_settings(settings);
|
||||
ses.set_alert_mask(~alert::progress_notification);
|
||||
ses.listen_on(std::make_pair(51000, 52000));
|
||||
ses.set_download_rate_limit(torrent_file->total_size() / 2);
|
||||
error_code ec;
|
||||
remove_all("./tmp2_web_seed", ec);
|
||||
|
||||
|
@ -94,7 +92,7 @@ void test_transfer(boost::intrusive_ptr<torrent_info> torrent_file, int proxy)
|
|||
|
||||
cache_status cs;
|
||||
|
||||
for (int i = 0; i < 15; ++i)
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
torrent_status s = th.status();
|
||||
session_status ss = ses.status();
|
||||
|
@ -120,8 +118,10 @@ void test_transfer(boost::intrusive_ptr<torrent_info> torrent_file, int proxy)
|
|||
|
||||
if (th.is_seed()/* && ss.download_rate == 0.f*/)
|
||||
{
|
||||
TEST_CHECK(ses.status().total_payload_download == total_size);
|
||||
TEST_CHECK(th.status().total_payload_download == total_size);
|
||||
// we need to sleep here a bit to let the session sync with the torrent stats
|
||||
test_sleep(1000);
|
||||
TEST_CHECK(ses.status().total_payload_download == total_size);
|
||||
break;
|
||||
}
|
||||
test_sleep(500);
|
||||
|
|
Loading…
Reference in New Issue