mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Keep and report some extra peer information.
This commit is contained in:
27
src/Peer.cpp
27
src/Peer.cpp
@@ -870,7 +870,15 @@ void Peer::recvStatus(newcoin::TMStatusChange& packet)
|
|||||||
Log(lsTRACE) << "Received status change from peer " << getIP();
|
Log(lsTRACE) << "Received status change from peer " << getIP();
|
||||||
if (!packet.has_networktime())
|
if (!packet.has_networktime())
|
||||||
packet.set_networktime(theApp->getOPs().getNetworkTimeNC());
|
packet.set_networktime(theApp->getOPs().getNetworkTimeNC());
|
||||||
mLastStatus = packet;
|
|
||||||
|
if (!mLastStatus.has_newstatus() || packet.has_newstatus())
|
||||||
|
mLastStatus = packet;
|
||||||
|
else
|
||||||
|
{ // preserve old status
|
||||||
|
newcoin::NodeStatus status = mLastStatus.newstatus();
|
||||||
|
mLastStatus = packet;
|
||||||
|
packet.set_newstatus(status);
|
||||||
|
}
|
||||||
|
|
||||||
if (packet.newevent() == newcoin::neLOST_SYNC)
|
if (packet.newevent() == newcoin::neLOST_SYNC)
|
||||||
{
|
{
|
||||||
@@ -1165,6 +1173,23 @@ Json::Value Peer::getJson()
|
|||||||
(mHello.protoversion() != MAKE_VERSION_INT(PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR)))
|
(mHello.protoversion() != MAKE_VERSION_INT(PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR)))
|
||||||
ret["protocol"] = boost::lexical_cast<std::string>(GET_VERSION_MAJOR(mHello.protoversion())) + "." +
|
ret["protocol"] = boost::lexical_cast<std::string>(GET_VERSION_MAJOR(mHello.protoversion())) + "." +
|
||||||
boost::lexical_cast<std::string>(GET_VERSION_MINOR(mHello.protoversion()));
|
boost::lexical_cast<std::string>(GET_VERSION_MINOR(mHello.protoversion()));
|
||||||
|
|
||||||
|
if (!!mClosedLedgerHash)
|
||||||
|
ret["ledger"] = mClosedLedgerHash.GetHex();
|
||||||
|
|
||||||
|
if (mLastStatus.has_newstatus())
|
||||||
|
{
|
||||||
|
switch (mLastStatus.newstatus())
|
||||||
|
{
|
||||||
|
case newcoin::nsCONNECTING: ret["status"] = "connecting"; break;
|
||||||
|
case newcoin::nsCONNECTED: ret["status"] = "connected"; break;
|
||||||
|
case newcoin::nsMONITORING: ret["status"] = "monitoring"; break;
|
||||||
|
case newcoin::nsVALIDATING: ret["status"] = "validating"; break;
|
||||||
|
case newcoin::nsSHUTTING: ret["status"] = "shutting"; break;
|
||||||
|
default: Log(lsWARNING) << "Peer has unknown status: " << mLastStatus.newstatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (!mIpPort.first.empty())
|
if (!mIpPort.first.empty())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user