ensure all immutable items are stored at least once

If num_peers is set to 1 then the item will never be stored. Bump the
minimum value to 2 so that announce_immutable_items stores all items
at least once.
This commit is contained in:
Steven Siloti 2016-01-12 19:32:02 -08:00
parent ceed5329f4
commit ab7ef98b01
1 changed files with 2 additions and 7 deletions

View File

@ -299,7 +299,7 @@ struct announce_item
sha1_hash target;
void gen()
{
num_peers = (rand() % 5) + 1;
num_peers = (rand() % 5) + 2;
ent["next"] = next.to_string();
ent["A"] = "a";
ent["B"] = "b";
@ -417,13 +417,8 @@ void announce_immutable_items(node& node, udp::endpoint const* eps
}
}
// TODO: check to make sure the "best" items are stored
TEST_EQUAL(items_num.size(), 4);
// items_num should contain 1,2 and 3
// #error this doesn't quite hold
// TEST_CHECK(items_num.find(1) != items_num.end());
// TEST_CHECK(items_num.find(2) != items_num.end());
// TEST_CHECK(items_num.find(3) != items_num.end());
}
int sum_distance_exp(int s, node_entry const& e, node_id const& ref)