Add job information to server_info.

This commit is contained in:
JoelKatz
2012-11-06 05:27:54 -08:00
parent ba09e48fc6
commit 19ab2e5b9c

View File

@@ -906,6 +906,23 @@ Json::Value NetworkOPs::getServerInfo()
if (mConsensus)
info["consensus"] = mConsensus->getJson();
typedef std::pair<JobType, int> jt_int_pair;
bool anyJobs = false;
Json::Value jobs = Json::arrayValue;
std::vector< std::pair<JobType, int> > jobCounts = theApp->getJobQueue().getJobCounts();
BOOST_FOREACH(jt_int_pair& it, jobCounts)
{
if (it.second != 0)
{
Json::Value o = Json::objectValue;
o[Job::toString(it.first)] = it.second;
jobs.append(o);
anyJobs = true;
}
}
if (anyJobs)
info["jobs"] = jobs;
return info;
}