Add load_factor to server_info in reporting mode

* load_factor was missing from server_info when the server was running in
  reporting mode. Now, the reporting mode server calls server_info on the p2p
  node, and propagates the load_factor back to the client.
This commit is contained in:
CJ Cobb
2021-04-09 14:56:13 -04:00
committed by manojsdoshi
parent 9106a06579
commit 430802c1cf

View File

@@ -17,7 +17,9 @@
*/
//==============================================================================
#include <ripple/app/main/Application.h>
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/app/reporting/P2pProxy.h>
#include <ripple/json/json_value.h>
#include <ripple/net/RPCErr.h>
#include <ripple/protocol/jss.h>
@@ -38,6 +40,12 @@ doServerInfo(RPC::JsonContext& context)
context.params.isMember(jss::counters) &&
context.params[jss::counters].asBool());
if (context.app.config().reporting())
{
Json::Value const proxied = forwardToP2p(context);
auto const lf = proxied[jss::result][jss::info][jss::load_factor];
ret[jss::info][jss::load_factor] = lf.isNull() ? 1 : lf;
}
return ret;
}