Adding node start observer.
This commit is contained in:
parent
00ac4d8c2a
commit
936e14ffe4
3 changed files with 21 additions and 0 deletions
|
|
@ -1296,3 +1296,22 @@ TEST (node, no_voting)
|
|||
}
|
||||
ASSERT_EQ (0, node1.network.confirm_ack_count);
|
||||
}
|
||||
|
||||
TEST (node, start_observer)
|
||||
{
|
||||
rai::node_init init;
|
||||
auto service (boost::make_shared <boost::asio::io_service> ());
|
||||
rai::alarm alarm (*service);
|
||||
auto path (rai::unique_path ());
|
||||
rai::logging logging (path);
|
||||
rai::work_pool work (std::numeric_limits <unsigned>::max (), nullptr);
|
||||
auto node (std::make_shared <rai::node> (init, *service, 0, path, alarm, logging, work));
|
||||
auto started (false);
|
||||
node->observers.started.add([&started] ()
|
||||
{
|
||||
started = true;
|
||||
});
|
||||
node->start ();
|
||||
ASSERT_TRUE (started);
|
||||
node->stop ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1552,6 +1552,7 @@ void rai::node::start ()
|
|||
active.announce_votes ();
|
||||
port_mapping.start ();
|
||||
add_initial_peers ();
|
||||
observers.started ();
|
||||
}
|
||||
|
||||
void rai::node::stop ()
|
||||
|
|
|
|||
|
|
@ -378,6 +378,7 @@ public:
|
|||
rai::observer_set <rai::vote const &, rai::endpoint const &> vote;
|
||||
rai::observer_set <rai::endpoint const &> endpoint;
|
||||
rai::observer_set <> disconnect;
|
||||
rai::observer_set <> started;
|
||||
};
|
||||
class vote_processor
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue