Reporting frontier_req progress.

This commit is contained in:
clemahieu 2017-07-03 00:42:56 -05:00
commit 1210f3a8ec
2 changed files with 6 additions and 2 deletions

View file

@ -267,7 +267,8 @@ std::shared_ptr <rai::bootstrap_client> rai::bootstrap_client::shared ()
rai::frontier_req_client::frontier_req_client (std::shared_ptr <rai::bootstrap_client> 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 ())

View file

@ -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
{