Removing usage of block_processor::flush from bootstrap_legacy and removing bootstrap_processor::flush.
This commit is contained in:
parent
701dbfd73f
commit
0ce4ed40b5
3 changed files with 6 additions and 16 deletions
|
@ -37,17 +37,6 @@ void nano::block_processor::stop ()
|
|||
nano::join_or_pass (processing_thread);
|
||||
}
|
||||
|
||||
void nano::block_processor::flush ()
|
||||
{
|
||||
flushing = true;
|
||||
nano::unique_lock<nano::mutex> lock{ mutex };
|
||||
while (!stopped && (have_blocks () || active))
|
||||
{
|
||||
condition.wait (lock);
|
||||
}
|
||||
flushing = false;
|
||||
}
|
||||
|
||||
std::size_t nano::block_processor::size ()
|
||||
{
|
||||
nano::unique_lock<nano::mutex> lock{ mutex };
|
||||
|
|
|
@ -29,7 +29,6 @@ class block_processor final
|
|||
public:
|
||||
explicit block_processor (nano::node &, nano::write_database_queue &);
|
||||
void stop ();
|
||||
void flush ();
|
||||
std::size_t size ();
|
||||
bool full ();
|
||||
bool half_full ();
|
||||
|
|
|
@ -223,10 +223,12 @@ void nano::bootstrap_attempt_legacy::run ()
|
|||
condition.wait (lock, [&stopped = stopped, &pulling = pulling] { return stopped || pulling == 0; });
|
||||
}
|
||||
|
||||
// Flushing may resolve forks which can add more pulls
|
||||
lock.unlock ();
|
||||
node->block_processor.flush ();
|
||||
lock.lock ();
|
||||
// TODO: This check / wait is a heuristic and should be improved.
|
||||
auto wait_start = std::chrono::steady_clock::now ();
|
||||
while (!stopped && node->block_processor.size () != 0 && ((std::chrono::steady_clock::now () - wait_start) < std::chrono::seconds{ 10 }))
|
||||
{
|
||||
condition.wait_for (lock, std::chrono::milliseconds{ 100 }, [this, node] { return stopped || node->block_processor.size () == 0; });
|
||||
}
|
||||
|
||||
if (start_account.number () != std::numeric_limits<nano::uint256_t>::max ())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue