mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 06:25:51 +00:00
Add uptime to crawl data (RIPD-997)
This commit is contained in:
committed by
Nik Bougalis
parent
1a3e2e3f36
commit
6cf75f0fc2
@@ -744,6 +744,7 @@ OverlayImpl::size()
|
||||
Json::Value
|
||||
OverlayImpl::crawl()
|
||||
{
|
||||
using namespace std::chrono;
|
||||
Json::Value jv;
|
||||
auto& av = jv["active"] = Json::Value(Json::arrayValue);
|
||||
std::lock_guard <decltype(mutex_)> lock (mutex_);
|
||||
@@ -752,12 +753,14 @@ OverlayImpl::crawl()
|
||||
if (auto const sp = e.second.lock())
|
||||
{
|
||||
auto& pv = av.append(Json::Value(Json::objectValue));
|
||||
pv[jss::type] = "peer";
|
||||
pv[jss::public_key] = beast::base64_encode(
|
||||
sp->getNodePublic().getNodePublic().data(),
|
||||
sp->getNodePublic().getNodePublic().size());
|
||||
pv[jss::type] = sp->slot()->inbound() ?
|
||||
"in" : "out";
|
||||
pv[jss::uptime] =
|
||||
static_cast<std::uint32_t>(duration_cast<seconds>(
|
||||
sp->uptime()).count());
|
||||
if (sp->crawl())
|
||||
{
|
||||
pv[jss::ip] = sp->getRemoteAddress().address().to_string();
|
||||
|
||||
Reference in New Issue
Block a user