forked from premiere/premiere-libtorrent
make test_recheck more robust
This commit is contained in:
parent
44c048f4f5
commit
777a0838ce
|
@ -56,19 +56,21 @@ void wait_for_complete(lt::session& ses, torrent_handle h)
|
|||
{
|
||||
int last_progress = 0;
|
||||
clock_type::time_point last_change = clock_type::now();
|
||||
for (int i = 0; i < 400; ++i)
|
||||
for (int i = 0; i < 200; ++i)
|
||||
{
|
||||
print_alerts(ses, "ses1");
|
||||
torrent_status st = h.status();
|
||||
std::fprintf(stderr, "%f %%\n", st.progress_ppm / 10000.f);
|
||||
std::fprintf(stderr, "%f s - %f %%\n"
|
||||
, total_milliseconds(clock_type::now() - last_change) / 1000.f
|
||||
, st.progress_ppm / 10000.f);
|
||||
if (st.progress_ppm == 1000000) return;
|
||||
if (st.progress_ppm != last_progress)
|
||||
{
|
||||
last_progress = st.progress_ppm;
|
||||
last_change = clock_type::now();
|
||||
}
|
||||
if (clock_type::now() - last_change > seconds(10)) break;
|
||||
std::this_thread::sleep_for(lt::milliseconds(500));
|
||||
if (clock_type::now() - last_change > seconds(20)) break;
|
||||
std::this_thread::sleep_for(lt::seconds(1));
|
||||
}
|
||||
TEST_ERROR("torrent did not finish");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue