Fix for the bootstrap request queue processing (#3461)
This commit is contained in:
parent
cffdc23659
commit
4255a384f9
1 changed files with 19 additions and 23 deletions
|
|
@ -551,20 +551,26 @@ void nano::bootstrap_server::finish_request ()
|
||||||
{
|
{
|
||||||
nano::unique_lock<nano::mutex> lock (mutex);
|
nano::unique_lock<nano::mutex> lock (mutex);
|
||||||
requests.pop ();
|
requests.pop ();
|
||||||
if (!requests.empty ())
|
|
||||||
|
while (!requests.empty ())
|
||||||
{
|
{
|
||||||
run_next (lock);
|
if (!requests.front ())
|
||||||
}
|
{
|
||||||
else
|
requests.pop ();
|
||||||
{
|
}
|
||||||
std::weak_ptr<nano::bootstrap_server> this_w (shared_from_this ());
|
else
|
||||||
node->workers.add_timed_task (std::chrono::steady_clock::now () + (node->config.tcp_io_timeout * 2) + std::chrono::seconds (1), [this_w] () {
|
{
|
||||||
if (auto this_l = this_w.lock ())
|
run_next (lock);
|
||||||
{
|
}
|
||||||
this_l->timeout ();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::weak_ptr<nano::bootstrap_server> this_w (shared_from_this ());
|
||||||
|
node->workers.add_timed_task (std::chrono::steady_clock::now () + (node->config.tcp_io_timeout * 2) + std::chrono::seconds (1), [this_w] () {
|
||||||
|
if (auto this_l = this_w.lock ())
|
||||||
|
{
|
||||||
|
this_l->timeout ();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void nano::bootstrap_server::finish_request_async ()
|
void nano::bootstrap_server::finish_request_async ()
|
||||||
|
|
@ -725,19 +731,9 @@ void nano::bootstrap_server::run_next (nano::unique_lock<nano::mutex> & lock_a)
|
||||||
// Realtime
|
// Realtime
|
||||||
auto request (std::move (requests.front ()));
|
auto request (std::move (requests.front ()));
|
||||||
requests.pop ();
|
requests.pop ();
|
||||||
auto timeout_check (requests.empty ());
|
|
||||||
lock_a.unlock ();
|
lock_a.unlock ();
|
||||||
request->visit (visitor);
|
request->visit (visitor);
|
||||||
if (timeout_check)
|
lock_a.lock ();
|
||||||
{
|
|
||||||
std::weak_ptr<nano::bootstrap_server> this_w (shared_from_this ());
|
|
||||||
node->workers.add_timed_task (std::chrono::steady_clock::now () + (node->config.tcp_io_timeout * 2) + std::chrono::seconds (1), [this_w] () {
|
|
||||||
if (auto this_l = this_w.lock ())
|
|
||||||
{
|
|
||||||
this_l->timeout ();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue