Finish the fetch_info command.

This commit is contained in:
JoelKatz
2013-07-23 13:03:09 -07:00
parent 273f50a10f
commit 96e1d1dd57
3 changed files with 17 additions and 6 deletions

View File

@@ -857,6 +857,9 @@ std::vector<InboundLedger::neededHash_t> InboundLedger::getNeededHashes ()
Json::Value InboundLedger::getJson (int)
{
Json::Value ret (Json::objectValue);
boost::recursive_mutex::scoped_lock sl (mLock);
ret["hash"] = mHash.GetHex ();
if (mComplete)

View File

@@ -51,6 +51,10 @@ public:
{
mAborted = true;
}
uint32 getSeq ()
{
return mSeq;
}
// VFALCO NOTE what is the meaning of the return value?
bool setAccept ()

View File

@@ -276,19 +276,23 @@ Json::Value InboundLedgers::getInfo()
Json::Value ret(Json::objectValue);
boost::mutex::scoped_lock sl (mLock);
std::vector<InboundLedger::pointer> acquires;
typedef std::pair<uint256, InboundLedger::pointer> u256_acq_pair;
std::vector<u256_acq_pair> acquires;
{
boost::mutex::scoped_lock sl (mLock);
acquires.reserve (mLedgers.size ());
typedef std::pair<uint256, InboundLedger::pointer> u256_acq_pair;
BOOST_FOREACH (const u256_acq_pair & it, mLedgers)
acquires.push_back (it.second);
BOOST_FOREACH (const u256_acq_pair & it, mLedgers)
acquires.push_back (it);
}
BOOST_FOREACH (const InboundLedger::pointer & acquire, acquires)
BOOST_FOREACH (const u256_acq_pair& it, acquires)
{
// WRITEME
uint32 seq = it.second->getSeq();
if (seq > 1)
ret[boost::lexical_cast<std::string>(seq)] = it.second->getJson(0);
else
ret[it.first.GetHex()] = it.second->getJson(0);
}
return ret;