Simplified vote_generator logic
This commit is contained in:
parent
7914c7c55d
commit
b7b0395a03
1 changed files with 4 additions and 10 deletions
|
@ -289,25 +289,19 @@ void nano::vote_generator::run ()
|
|||
nano::unique_lock<nano::mutex> lock{ mutex };
|
||||
while (!stopped)
|
||||
{
|
||||
if (candidates.size () >= nano::network::confirm_ack_hashes_max)
|
||||
condition.wait_for (lock, config.vote_generator_delay, [this] () { return this->candidates.size () >= nano::network::confirm_ack_hashes_max || !requests.empty (); });
|
||||
|
||||
if (!candidates.empty ())
|
||||
{
|
||||
broadcast (lock);
|
||||
}
|
||||
|
||||
if (!requests.empty ())
|
||||
{
|
||||
auto request (requests.front ());
|
||||
requests.pop_front ();
|
||||
reply (lock, std::move (request));
|
||||
}
|
||||
else
|
||||
{
|
||||
condition.wait_for (lock, config.vote_generator_delay, [this] () { return this->candidates.size () >= nano::network::confirm_ack_hashes_max; });
|
||||
|
||||
if (!candidates.empty ())
|
||||
{
|
||||
broadcast (lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue