improve test robustness

This commit is contained in:
arvidn 2016-07-01 00:23:56 -04:00
parent 07f78264e3
commit f5bb8c4b77
2 changed files with 2 additions and 3 deletions

View File

@ -452,8 +452,7 @@ boost::shared_ptr<torrent_info> setup_peer(tcp::socket& s, sha1_hash& ih
{ {
tcp::acceptor l(s.get_io_service()); tcp::acceptor l(s.get_io_service());
l.open(tcp::v4()); l.open(tcp::v4());
l.bind(tcp::endpoint(address_v4::from_string("127.0.0.1") l.bind(tcp::endpoint(address_v4::from_string("127.0.0.1"), 0));
, 3000 + rand() % 60000));
l.listen(); l.listen();
tcp::endpoint addr = l.local_endpoint(); tcp::endpoint addr = l.local_endpoint();

View File

@ -769,7 +769,7 @@ void test_rename_file_fastresume(bool test_deprecated)
h.rename_file(0, "testing_renamed_files"); h.rename_file(0, "testing_renamed_files");
std::cout << "renaming file" << std::endl; std::cout << "renaming file" << std::endl;
bool renamed = false; bool renamed = false;
for (int i = 0; i < 10; ++i) for (int i = 0; i < 30; ++i)
{ {
if (print_alerts(ses, "ses", true, true, true, &got_file_rename_alert)) renamed = true; if (print_alerts(ses, "ses", true, true, true, &got_file_rename_alert)) renamed = true;
torrent_status s = h.status(); torrent_status s = h.status();