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 <boost/thread.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
@@ -999,7 +1000,8 @@ protected:
|
|||||||
str << s << " ";
|
str << s << " ";
|
||||||
if (log)
|
if (log)
|
||||||
std::cout
|
std::cout
|
||||||
<< (double)reduce_relay::epoch<milliseconds>(now)
|
<< (double)std::chrono::duration_cast<milliseconds>(
|
||||||
|
now.time_since_epoch())
|
||||||
.count() /
|
.count() /
|
||||||
1000.
|
1000.
|
||||||
<< " random, squelched, validator: " << validator.id()
|
<< " random, squelched, validator: " << validator.id()
|
||||||
@@ -1091,9 +1093,13 @@ protected:
|
|||||||
event.isSelected_ =
|
event.isSelected_ =
|
||||||
network_.overlay().isSelected(*event.key_, event.peer_);
|
network_.overlay().isSelected(*event.key_, event.peer_);
|
||||||
auto peers = network_.overlay().getPeers(*event.key_);
|
auto peers = network_.overlay().getPeers(*event.key_);
|
||||||
auto d = reduce_relay::epoch<milliseconds>(now).count() -
|
|
||||||
reduce_relay::epoch<milliseconds>(
|
auto d =
|
||||||
peers[event.peer_].lastMessage)
|
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();
|
.count();
|
||||||
|
|
||||||
mustHandle = event.isSelected_ &&
|
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.
|
/** Abstract class. Declares squelch and unsquelch handlers.
|
||||||
* OverlayImpl inherits from this class. Motivation is
|
* OverlayImpl inherits from this class. Motivation is
|
||||||
* for easier unit tests to facilitate on the fly
|
* for easier unit tests to facilitate on the fly
|
||||||
|
|||||||
@@ -315,8 +315,9 @@ bool
|
|||||||
Slots::reduceRelayReady()
|
Slots::reduceRelayReady()
|
||||||
{
|
{
|
||||||
if (!reduceRelayReady_)
|
if (!reduceRelayReady_)
|
||||||
reduceRelayReady_ = reduce_relay::epoch<std::chrono::minutes>(
|
reduceRelayReady_ =
|
||||||
clock_.now()) > reduce_relay::WAIT_ON_BOOTUP;
|
std::chrono::duration_cast<std::chrono::minutes>(
|
||||||
|
clock_.now().time_since_epoch()) > reduce_relay::WAIT_ON_BOOTUP;
|
||||||
|
|
||||||
return reduceRelayReady_;
|
return reduceRelayReady_;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user