From 1210f3a8ec50ba0e4bb83610648e3124ee272bdc Mon Sep 17 00:00:00 2001 From: clemahieu Date: Mon, 3 Jul 2017 00:42:56 -0500 Subject: [PATCH] Reporting frontier_req progress. --- rai/node/bootstrap.cpp | 7 +++++-- rai/node/bootstrap.hpp | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rai/node/bootstrap.cpp b/rai/node/bootstrap.cpp index b00bc19e..2873ae6c 100755 --- a/rai/node/bootstrap.cpp +++ b/rai/node/bootstrap.cpp @@ -267,7 +267,8 @@ std::shared_ptr rai::bootstrap_client::shared () rai::frontier_req_client::frontier_req_client (std::shared_ptr const & connection_a) : connection (connection_a), current (0), -count (0) +count (0), +next_report (std::chrono::system_clock::now () + std::chrono::seconds (15)) { next (); } @@ -334,8 +335,10 @@ void rai::frontier_req_client::received_frontier (boost::system::error_code cons auto error2 (rai::read (latest_stream, latest)); assert (!error2); ++count; - if (count % 16384 == 0) + auto now (std::chrono::system_clock::now ()); + if (next_report < now) { + next_report = now + std::chrono::seconds (15); BOOST_LOG (connection->node->log) << boost::str (boost::format ("Received %1% frontiers from %2%") % std::to_string (count) % connection->socket.remote_endpoint ()); } if (!account.is_zero ()) diff --git a/rai/node/bootstrap.hpp b/rai/node/bootstrap.hpp index 63086cee..7d895d62 100644 --- a/rai/node/bootstrap.hpp +++ b/rai/node/bootstrap.hpp @@ -97,6 +97,7 @@ public: rai::account current; rai::account_info info; unsigned count; + std::chrono::system_clock::time_point next_report; }; class bulk_pull_client {