diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index 4779171ed..f535d1d26 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -335,14 +335,22 @@ bool downloading_alert(libtorrent::alert const* a) void wait_for_downloading(lt::session& ses, char const* name) { + time_point start = clock_type::now(); downloading_done = false; alert const* a = 0; do { print_alerts(ses, name, true, true, true, &downloading_alert, false); if (downloading_done) break; - a = ses.wait_for_alert(milliseconds(500)); + if (total_seconds(clock_type::now() - start) > 10) break; + a = ses.wait_for_alert(seconds(2)); } while (a); + if (!downloading_done) + { + fprintf(stderr, "did not receive a state_changed_alert indicating " + "the torrent is downloading. waited: %d ms\n" + , int(total_milliseconds(clock_type::now() - start))); + } } void print_ses_rate(float time diff --git a/test/swarm_suite.cpp b/test/swarm_suite.cpp index 1535f00d9..d8c781443 100644 --- a/test/swarm_suite.cpp +++ b/test/swarm_suite.cpp @@ -212,7 +212,7 @@ void test_swarm(int flags) while ((ret = ses1.wait_for_alert(seconds(2)))) { fprintf(stderr, "wait returned: %d ms\n" - , total_milliseconds(clock_type::now() - start)); + , int(total_milliseconds(clock_type::now() - start))); std::vector alerts; ses1.pop_alerts(&alerts); for (std::vector::iterator i = alerts.begin() @@ -224,7 +224,7 @@ void test_swarm(int flags) } fprintf(stderr, "loop returned: %d ms\n" - , total_milliseconds(clock_type::now() - start)); + , int(total_milliseconds(clock_type::now() - start))); // this allows shutting down the sessions in parallel p1 = ses1.abort(); @@ -233,7 +233,7 @@ void test_swarm(int flags) time_point end = clock_type::now(); - fprintf(stderr, "time: %d ms\n", total_milliseconds(end - start)); + fprintf(stderr, "time: %d ms\n", int(total_milliseconds(end - start))); TEST_CHECK(end - start < seconds(3)); TEST_CHECK(end - start >= seconds(2));