Assert no error code when calling system::poll_until_true (#3895)
This commit is contained in:
parent
8639f4b393
commit
64d6b59e55
1 changed files with 35 additions and 23 deletions
|
|
@ -71,40 +71,52 @@ std::shared_ptr<nano::node> nano::test::system::add_node (nano::node_config cons
|
||||||
(*j)->network.send_keepalive (channel);
|
(*j)->network.send_keepalive (channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
poll_until_true (3s, [&node1, &node2, starting_size_1, starting_size_2] () {
|
{
|
||||||
auto size_1 = node1->network.size ();
|
auto ec = poll_until_true (3s, [&node1, &node2, starting_size_1, starting_size_2] () {
|
||||||
auto size_2 = node2->network.size ();
|
auto size_1 = node1->network.size ();
|
||||||
return size_1 > starting_size_1 && size_2 > starting_size_2;
|
auto size_2 = node2->network.size ();
|
||||||
});
|
return size_1 > starting_size_1 && size_2 > starting_size_2;
|
||||||
|
});
|
||||||
|
debug_assert (!ec);
|
||||||
|
}
|
||||||
|
|
||||||
if (type_a == nano::transport::transport_type::tcp && node_config_a.tcp_incoming_connections_max != 0 && !node_flags_a.disable_tcp_realtime)
|
if (type_a == nano::transport::transport_type::tcp && node_config_a.tcp_incoming_connections_max != 0 && !node_flags_a.disable_tcp_realtime)
|
||||||
{
|
{
|
||||||
// Wait for initial connection finish
|
{
|
||||||
poll_until_true (3s, [&node1, &node2, starting_realtime_1, starting_realtime_2] () {
|
// Wait for initial connection finish
|
||||||
auto realtime_1 = node1->bootstrap.realtime_count.load ();
|
auto ec = poll_until_true (3s, [&node1, &node2, starting_realtime_1, starting_realtime_2] () {
|
||||||
auto realtime_2 = node2->bootstrap.realtime_count.load ();
|
auto realtime_1 = node1->bootstrap.realtime_count.load ();
|
||||||
return realtime_1 > starting_realtime_1 && realtime_2 > starting_realtime_2;
|
auto realtime_2 = node2->bootstrap.realtime_count.load ();
|
||||||
});
|
return realtime_1 > starting_realtime_1 && realtime_2 > starting_realtime_2;
|
||||||
|
});
|
||||||
// Wait for keepalive message exchange
|
debug_assert (!ec);
|
||||||
poll_until_true (3s, [&node1, &node2, starting_keepalives_1, starting_keepalives_2] () {
|
}
|
||||||
auto keepalives_1 = node1->stats.count (stat::type::message, stat::detail::keepalive, stat::dir::in);
|
{
|
||||||
auto keepalives_2 = node2->stats.count (stat::type::message, stat::detail::keepalive, stat::dir::in);
|
// Wait for keepalive message exchange
|
||||||
return keepalives_1 > starting_keepalives_1 && keepalives_2 > starting_keepalives_2;
|
auto ec = poll_until_true (3s, [&node1, &node2, starting_keepalives_1, starting_keepalives_2] () {
|
||||||
});
|
auto keepalives_1 = node1->stats.count (stat::type::message, stat::detail::keepalive, stat::dir::in);
|
||||||
|
auto keepalives_2 = node2->stats.count (stat::type::message, stat::detail::keepalive, stat::dir::in);
|
||||||
|
return keepalives_1 > starting_keepalives_1 && keepalives_2 > starting_keepalives_2;
|
||||||
|
});
|
||||||
|
debug_assert (!ec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure no bootstrap initiators are in progress
|
{
|
||||||
poll_until_true (3s, [this, &begin] () {
|
// Ensure no bootstrap initiators are in progress
|
||||||
return std::all_of (begin, nodes.end (), [] (std::shared_ptr<nano::node> const & node_a) { return !node_a->bootstrap_initiator.in_progress (); });
|
auto ec = poll_until_true (3s, [this, &begin] () {
|
||||||
});
|
return std::all_of (begin, nodes.end (), [] (std::shared_ptr<nano::node> const & node_a) { return !node_a->bootstrap_initiator.in_progress (); });
|
||||||
|
});
|
||||||
|
debug_assert (!ec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
poll_until_true (3s, [&node] () {
|
auto ec = poll_until_true (3s, [&node] () {
|
||||||
return !node->bootstrap_initiator.in_progress ();
|
return !node->bootstrap_initiator.in_progress ();
|
||||||
});
|
});
|
||||||
|
debug_assert (!ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue