WS: Do not announce unvalidated ledgers.

This commit is contained in:
Arthur Britto
2012-10-17 13:25:34 -07:00
parent 56a7e48cd9
commit 851768848b
2 changed files with 11 additions and 4 deletions

View File

@@ -801,6 +801,9 @@ void WSConnection::doLedgerEntry(Json::Value& jvResult, const Json::Value& jvReq
}
}
// The objective is to allow the client to know the server's status. The only thing that show the server is fully operating is the
// stream of ledger_closeds. Therefore, that is all that is provided. A client can drop servers that do not provide recent
// ledger_closeds.
void WSConnection::doServerSubscribe(Json::Value& jvResult, const Json::Value& jvRequest)
{
if (!mNetwork.subLedger(this))
@@ -812,10 +815,10 @@ void WSConnection::doServerSubscribe(Json::Value& jvResult, const Json::Value& j
if (theConfig.RUN_STANDALONE)
jvResult["stand_alone"] = 1;
// XXX Make sure these values are available before returning them.
// XXX return connected status.
jvResult["ledger_closed"] = mNetwork.getClosedLedger().ToString();
jvResult["ledger_current_index"] = mNetwork.getCurrentLedgerID();
if (NetworkOPs::omDISCONNECTED != mNetwork.getOperatingMode()) {
jvResult["ledger_closed"] = mNetwork.getClosedLedger().ToString();
jvResult["ledger_current_index"] = mNetwork.getCurrentLedgerID();
}
}
}