diff --git a/rai/node/bootstrap.cpp b/rai/node/bootstrap.cpp index b176341e..4f20e109 100644 --- a/rai/node/bootstrap.cpp +++ b/rai/node/bootstrap.cpp @@ -1030,17 +1030,20 @@ void rai::bootstrap_attempt::requeue_pull (rai::pull_info const & pull_a) pulls.push_front (pull); condition.notify_all (); } - else if (pull.attempts == 4 && !connection_frontier_request.expired ()) + else if (pull.attempts == 4) { std::lock_guard lock (mutex); - auto connection_shared = connection_frontier_request.lock (); - auto client (std::make_shared (connection_shared)); - node->background ([client, pull]() { - client->request (pull); - }); - if (node->config.logging.bulk_pull_logging ()) + + if (auto connection_shared = connection_frontier_request.lock ()) { - BOOST_LOG (node->log) << boost::str (boost::format ("Requesting pull account %1% from frontier peer after %2% attempts") % pull.account.to_account () % pull.attempts); + auto client (std::make_shared (connection_shared)); + node->background ([client, pull]() { + client->request (pull); + }); + if (node->config.logging.bulk_pull_logging ()) + { + BOOST_LOG (node->log) << boost::str (boost::format ("Requesting pull account %1% from frontier peer after %2% attempts") % pull.account.to_account () % pull.attempts); + } } } else