mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
improves code readabiliy
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <iterator>
|
||||
#include <numeric>
|
||||
#include <optional>
|
||||
@@ -999,7 +1000,8 @@ protected:
|
||||
str << s << " ";
|
||||
if (log)
|
||||
std::cout
|
||||
<< (double)reduce_relay::epoch<milliseconds>(now)
|
||||
<< (double)std::chrono::duration_cast<milliseconds>(
|
||||
now.time_since_epoch())
|
||||
.count() /
|
||||
1000.
|
||||
<< " random, squelched, validator: " << validator.id()
|
||||
@@ -1091,9 +1093,13 @@ protected:
|
||||
event.isSelected_ =
|
||||
network_.overlay().isSelected(*event.key_, event.peer_);
|
||||
auto peers = network_.overlay().getPeers(*event.key_);
|
||||
auto d = reduce_relay::epoch<milliseconds>(now).count() -
|
||||
reduce_relay::epoch<milliseconds>(
|
||||
peers[event.peer_].lastMessage)
|
||||
|
||||
auto d =
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
now.time_since_epoch())
|
||||
.count() -
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
peers[event.peer_].lastMessage.time_since_epoch())
|
||||
.count();
|
||||
|
||||
mustHandle = event.isSelected_ &&
|
||||
|
||||
@@ -90,13 +90,6 @@ to_string(SlotState state)
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Unit, typename TP>
|
||||
Unit
|
||||
epoch(TP const& t)
|
||||
{
|
||||
return std::chrono::duration_cast<Unit>(t.time_since_epoch());
|
||||
}
|
||||
|
||||
/** Abstract class. Declares squelch and unsquelch handlers.
|
||||
* OverlayImpl inherits from this class. Motivation is
|
||||
* for easier unit tests to facilitate on the fly
|
||||
|
||||
@@ -315,8 +315,9 @@ bool
|
||||
Slots::reduceRelayReady()
|
||||
{
|
||||
if (!reduceRelayReady_)
|
||||
reduceRelayReady_ = reduce_relay::epoch<std::chrono::minutes>(
|
||||
clock_.now()) > reduce_relay::WAIT_ON_BOOTUP;
|
||||
reduceRelayReady_ =
|
||||
std::chrono::duration_cast<std::chrono::minutes>(
|
||||
clock_.now().time_since_epoch()) > reduce_relay::WAIT_ON_BOOTUP;
|
||||
|
||||
return reduceRelayReady_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user